function [h]=arrows4(x,y,w,fac,color,erasemode)
% function [h]=arrows4(x,y,w,fac,color,erasemode)
%    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 x scaling factor and fac2 is the y scaling
%	factor. 
%
% arrows(x,y,w,fac,linetype) 
%    sets fac2=fac1,linetype='-'
%
%
i=sqrt(-1);
%
%  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.
%
HEADA=5*pi/180; HEADL=.75;
z=x(:)+i*y(:);

if nargin < 7,erasemode='none';end
if nargin < 6,color='white';end
if nargin < 5,style='-';end
if nargin < 4,help arrows4,end
w=w*fac;
r=w*HEADL; wr1=r*exp(+i*HEADA); wr2=r*exp(-i*HEADA);
wplot=ones(length(z),5); 
wplot(:,1)=z; 
wplot(:,[2,4])=(z+w)*ones(1,2);
wplot(:,3)=z+wr1; wplot(:,5)=z+wr2;
h=line(real(wplot)',imag(wplot)','color',color,'erasemode',erasemode);
set(h(1),'userdata',fac);
