用Matlab生成圆
function myCircle(x, y)
%给两个点的坐标,以一个点为圆心 x =[a,b] ,长度为半径
plot([x(1),y(1)],[x(2),y(2)],'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',1);
hold on
for theta=0:0.1:360
x1 = cos(theta/180*pi) * (y(1)-x(1)) - ...
sin(theta/180*pi)*(y(2)-x(2)) + x(1);
y1 = sin(theta/180*pi) * (y(1)-x(1)) + ...
cos(theta/180*pi)*(y(2)-x(2)) + x(2);
plot(x1,y1,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',1)
end
算法原理