circle.m(画二维圆的函数)
%该函数是画二维圆圈,输入圆心坐标和半径
%rectangle()函数参数‘linewidth’修饰曲线的宽度
%'edgecolor','r',edgecolor表示边框颜色,r表示颜色参数
%'facecolor','b',facecolor表示内部填充颜色,b表示颜色参数
function [] = circle( x,y,r )
rectangle('Position',[x-r,y-r,2*r,2*r],'Curvature',[1,1],'linewidth',1);
axis equal;
end
draw_arrow.m(画两坐标点之间箭头的函数)
%该函数是画从一坐标点到另一坐标点的指向箭头
function draw_arrow(start_point, end_point)
% 从start_point到end_point画一箭头
K = 0.05; %箭头比例系数
theta = pi / 8; %箭头角度
A1 = [cos(theta), -sin(theta);
sin(theta), cos(theta)]; %旋转矩阵
theta = -theta;
A2 = [cos(theta), -sin(theta);
sin(theta), cos(theta)]; %旋转矩阵
arrow = start_point' - end_point';
arrow_1 = A1 * arrow;</