How to animate a cosine plot using getframe
6 次查看(过去 30 天)
显示 更早的评论
Hi, I'm pretty new to Matlab and I've been playing around trying to animate a 2D cosine graph using the getframe function. Here's my code
t=0:pi/100:10;
tlength = numel(t);
for i=1:tlength
plot(cos(t));
F(:,i) = getframe;
end
movie(F);
But when I try running it it's not animated at all, just a still plot. What am I doing wrong?
0 个评论
采纳的回答
KSSV
2020-9-28
t=0:pi/100:10;
tlength = numel(t);
for i=1:tlength
plot(cos(1:t(i)));
F(:,i) = getframe;
end
movie(F);
Also read about comet
t=0:pi/100:10;
y = cos(t) ;
comet(t,y)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!