📄 rotarrow.m
字号:
function rotarrow(A,colorspec)
% plots a colored line vector in 2D starting at origin and ending with arrow at terminus
% A specifies the coordinates of the terminus point
% colorspec='k|r|b|g|y|m|c' or colorspec=[RGB value]
x=[0 A(1)];
y=[0 A(2)];
lsc=sqrt(A(1)^2+A(2)^2);
line(x,y,'color',colorspec);
ax=axis;
qx=(ax(2)-ax(1))*.05*lsc;
qy=(ax(4)-ax(3))*.015*lsc;
phi=180/pi*(atan2(A(2),A(1)));
h0=patch([A(1)-qx A(1) A(1)-qx],[A(2)+qy A(2) A(2)-qy],colorspec,'edgecolor',colorspec);
rotate(h0,[A(1) A(2) 500],phi,[A(1) A(2) 0]);
axis equal;
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -