填充图动画(极性功能)
我在作业中显示了一组视频。该动画是如何创建的?我正在尝试创建类似的东西。以下是我的尝试;它只是绘图线,因为我相信它没有填充正确的输入。指导将不胜感激
clear;close all;
th = 0:0.1:pi*2
r = cos(2*th) .* sin(2*th);
x = r .* cos(th);
y = r .* sin(th);
plot(x,y);
hold on
for th = 0:0.1:pi*2
x0 = [r .* cos(th)];
y0 = [r .* sin(th)];
fill(x0,y0,'b');
pause (0.5);
end
hold off
I have a set of videos shown in an assignment. How is this animation created? I am trying to create something similar. Below is my attempt; it is only drawing lines because I believe it is not filling in the correct inputs. Guidance would be much appreciated
clear;close all;
th = 0:0.1:pi*2
r = cos(2*th) .* sin(2*th);
x = r .* cos(th);
y = r .* sin(th);
plot(x,y);
hold on
for th = 0:0.1:pi*2
x0 = [r .* cos(th)];
y0 = [r .* sin(th)];
fill(x0,y0,'b');
pause (0.5);
end
hold off
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我设法用Polarplot(Th,Radius)在极性坐标中绘制该功能,我无法填充黄色,也不会使图动画,对不起。
I managed to draw the function in polar coordinates with polarplot(th, radius), I could not fill with yellow color and neither animate the graph, I'm sorry.
可以通过填写列表来绘制类似的动画。将
clf
放在前面的循环中是可选的。以下代码动画了一朵小花的绘图过程。通过更改轴,花将看起来比例更大或更小。
A similar animation can be drawn by filling from lists. Putting
clf
in the for-loop is optional.This following code animates the drawing process of a small flower. The flower will look proportionally bigger or smaller by changing the axis.