Matlab画箭头arrow.m
Posted rtoax
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Matlab画箭头arrow.m相关的知识,希望对你有一定的参考价值。
源码网址点击打开链接
function arrow(P,V,color,LineWidth)
%起点P,V变化量
if 1 <= nargin < 3
color = 'b';
end
x0 = P(1);y0 = P(2);
a = V(1); b = V(2);
l = max(norm(V), eps);
u = [x0 x0 a]; v = [y0 y0 b];
hchek = ishold;
plot(u,v,color,'LineWidth',LineWidth)
hold on
h = l - min(.2*l, .2) ;
v = min(.2*l/sqrt(3), .2/sqrt(3) );
a1 = (a*h - b*v)/l;
b1 = (b*h + a*v)/l;
plot([x0 a1, x0 a], [y0 b1, y0 b], color,'LineWidth',LineWidth)
a2 = (a*h + b*v)/l;
b2 = (b*h - a*v)/l;
plot([x0 a2, x0 a], [y0 b2, y0 b], color,'LineWidth',LineWidth)
if hchek == 0
hold off
end
以上是关于Matlab画箭头arrow.m的主要内容,如果未能解决你的问题,请参考以下文章