function plotvector3( v, s, sp ) % plot an arrow for the 3D-vector v % v: the 3D vector % s: a string passed to quiver for the color % sp: if this string is set it defines the color of some helper lines if nargin < 2 s = 'b'; end quiver3( [0.0], [0.0], [0.0], [v(1)], [v(2)], [v(3)], 1.0, s ); view( 42, 12 ); grid on if nargin == 3 hh = ishold; if ~hh hold on; end plot3( [v(1) v(1)], [v(2) v(2)], [0.0 v(3)], sp ); plot3( [0.0 v(1) v(1)], [v(2) v(2) 0.0], [0.0 0.0 0.0], sp ); if ~hh hold off; end end end