如何在圆上旋转360度(每20度)并找到相交的坐标?
r = 1;
xc = 5;
yc = 5;
theta = linspace(0,2*pi);
x = r*cos(theta) + xc;
y = r*sin(theta) + yc;
plot(x,y)
axis equal
hold on
plot([xc xc-2],[yc yc])
答案 0 :(得分:2)
您只需要构建一个粗略的linspace:
how_many_point = 360 / 20
coarse_theta = linspace(0, 2*pi, how_many_point + 1)
xs = xc + cos(coarse_theta)
ys = yc + sin(coarse_theta)
for i = 1:how_many_point
plot([xs(i) xc], [ys(i) yc]); hold on
end