%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % plotvectorfield % % Plots quiver plot of vector function values at selected points. % % % Author: Carlos J. Cela % Version: V1.0, 2012-01-08 % License: Please feel free to use this for anything you need. % % Use: % plotvectorfield % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Generate mesh in x, y [x,y] = meshgrid(0:.1:2); % Define vector field vx = sqrt(x+y); vy = sin(y)+x; % Overlap quiver plot quiver(x,y,vx,vy,'r','linewidth',3); axis([0 2 0 2],'square'); grid on colormap gray;