function flecha(p1,p2,tam);
% flecha(p1,p2,tam);
%
% p1,p2:  son dos vectores columna de R2 indicando origen y final
%         de la flecha
% tam:    es un escalar, indicando el tamaño de la cabeza de la flecha

N1 = length(p1);
N2 = length(p2);

p1 = p1(:);
p2 = p2(:);

if N1==1
    p1  = repmat(p1,N2,1);
elseif N2==1
    p2  = repmat(p2,N1,1);
elseif N1~=N2
    idx = rectop(1:N1,1:N2,'idx');
    p1  = p1(idx(1,:));
    p2  = p2(idx(2,:));
end


hld = ishold;
for k = 1:length(p1)
    
    p3 = p2(k)-p1(k);
    p4 = p2(k)-sign(p3)*tam*exp(+j*0.2);
    p5 = p2(k)-sign(p3)*tam*exp(-j*0.2);
    
    
    P1 = [real(p1(k)),imag(p1(k))]';
    P2 = [real(p2(k)),imag(p2(k))]';
    P3 = [real(p3),imag(p3)]';
    P4 = [real(p4),imag(p4)]';
    P5 = [real(p5),imag(p5)]';
    
    p = [P2 P4 P5];
    
    plotp([P1 P2],'-');
    patch(p(1,:),p(2,:),'b');
    hold on;
end
if ~hld
    hold off;
end
