function h=plotvector2d(origin,vector,varargin) % PLOTVECTOR2D - draws a single 2-D arrow (with line properties in varargin) for vector v starting at cooridinate origin % % Usage: plotvector2d(origin,vector,linespecs) % where origin is a 2-D vector for where the base of the vector starts % vector is the vector to be plotted % and linespec is a cell string of line specifications % % Examples % % plotvector2d([0 0]',[1 2]','r') % or % x=[0 0]'; y=[1 2]'; % plotvector2d(x,y); % plotvector2d(x,y,'g--'); % % returns a linehandle to the vector % [x,y]=meshgrid(origin(1),origin(2)); h=quiver(x,y,vector(1),vector(2),0,varargin{:}); %axis image; axis xy; return