


function [h]=arrows(x,y,w,fac,color)
Draws arrows with their tails at each point corresponding
to identical indices in the matrices x,y. The matrices u
and v are the components of the vector to be represented.
fac is the scaling factor
Geometry of arrowheads (choosing HEADA and HEADL):
If the arrow is defined by the points A B C B D where A is the base of
the arrow, B is the head, and C and D are the corners of the arrowhead, then
HEADA is the angle BAC (or BAD), and HEADL is the ratio of distances AC/AB.

0001 function [h]=arrows(x,y,w,fac,color) 0002 % function [h]=arrows(x,y,w,fac,color) 0003 % Draws arrows with their tails at each point corresponding 0004 % to identical indices in the matrices x,y. The matrices u 0005 % and v are the components of the vector to be represented. 0006 % fac is the scaling factor 0007 % 0008 % Geometry of arrowheads (choosing HEADA and HEADL): 0009 % If the arrow is defined by the points A B C B D where A is the base of 0010 % the arrow, B is the head, and C and D are the corners of the arrowhead, then 0011 % HEADA is the angle BAC (or BAD), and HEADL is the ratio of distances AC/AB. 0012 % 0013 0014 % revision 3/20/97 to use nans for line breaks 0015 % much more efficient and returns only a single handle 0016 0017 HEADA=10*pi/180; HEADL=.75; 0018 z=x(:)+i*y(:); 0019 0020 if nargin < 5,color='red';end 0021 if nargin < 4,help arrows,end 0022 w=w(:)*fac; 0023 r=w*HEADL; wr1=r*exp(+i*HEADA); wr2=r*exp(-i*HEADA); 0024 wplot=ones(length(z),6); 0025 wplot(:,1)=z; 0026 wplot(:,[2,4])=(z+w)*ones(1,2); 0027 wplot(:,3)=z+wr1; wplot(:,5)=z+wr2; 0028 wplot(:,6)=z*nan; 0029 wplot=wplot.'; 0030 wplot=wplot(:); 0031 %z=eps*ones(size(wplot)); 0032 %h=line(real(wplot),imag(wplot),z,'color',color); 0033 h=line(real(wplot),imag(wplot),'color',color); 0034 set(h(1),'userdata',fac);