function arrowsimple(X,Y,C) L = sqrt((X(1,:)-X(end,:)).^2 + (Y(1,:)-Y(end,:)).^2); vecX = [(X(1,:)-X(end,:))]; vecY = [(Y(1,:)-Y(end,:))]; vecXp = -vecY; vecYp = vecX; fraction = 0.1; fraction2 = 0.03; arrowheadX = [ X(end,:)+fraction*vecX + fraction2*vecXp X(end,:)+fraction*vecX - fraction2*vecXp X(end,:) ]; arrowheadY = [ Y(end,:)+fraction*vecY + fraction2*vecYp Y(end,:)+fraction*vecY - fraction2*vecYp Y(end,:) ]; hold on plot([X;arrowheadX],[Y;arrowheadY],C)