function h=plotvector3d(origin,vector,varargin) % PLOTVECTOR3D - draws a single 3-D arrow (with line properties in % varargin) for vector v starting at cooridinate origin % % Usage: plotvector3d(origin,vector,linespecs) % where origin is a 3-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 % % plotvector3d([1 1 3]',[1 2 3]','r') % or % x=[0 0 0]'; y=[1 2 -3]'; % plotvector3d(x,y); % plotvector3d(x,y,'g--'); % % returns a linehandle to the vector % [x,y,z]=meshgrid(origin(1),origin(2),origin(3)); h=quiver3(x,y,z,vector(1),vector(2),vector(3),0,varargin{:}); axis image; axis xy; return