在追踪曲线时填充极花图
我一直在将坐标重新排列到多维结构x1
和y1
中,因此它不仅仅是填充作为普通的余弦波。帮助您非常感谢。
clear;close all;
x = 0:0.01:pi*2;
r = cos(2*x).*sin(2*x);
figure
polar(x,r);
input('Press ENTER to start.');
hold on;
for x0 = x
r0 = cos(2*x0).*sin(2*x0);
polar(x0,r0,'o');
x1 = [x0 2*pi 0];
r1 = [r0 0 0];
fill(x1,r1,'b');
pause(0.033);
end
hold off;
I'd like to animate a polar flower plot being drawn. I would hope for the result to look like this plot:
However the current result looks like this:
I've been rearranging the coordinates into multidimensional structs x1
and y1
, so it isn't just filling in as a plain cosine wave. Help is much appreciated.
clear;close all;
x = 0:0.01:pi*2;
r = cos(2*x).*sin(2*x);
figure
polar(x,r);
input('Press ENTER to start.');
hold on;
for x0 = x
r0 = cos(2*x0).*sin(2*x0);
polar(x0,r0,'o');
x1 = [x0 2*pi 0];
r1 = [r0 0 0];
fill(x1,r1,'b');
pause(0.033);
end
hold off;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
填充(..)采用笛卡尔坐标,而不是极性坐标。
因此,您必须在调用填充()之前将极性参数转换为笛卡尔坐标。然后,除非需要极性框架,否则不需要调用极地(..)。
fill(..) takes cartesian coordinates, not polar ones.
So you must convert polar parameters into cartesian coordinates before calling fill(). Then, unless you need the polar frame, calling polar(..) is not required.