How to animate a cosine plot using getframe

8 ビュー (過去 30 日間)
jm
jm 2020 年 9 月 28 日
コメント済み: KSSV 2020 年 9 月 28 日
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?

採用された回答

KSSV
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)
  2 件のコメント
jm
jm 2020 年 9 月 28 日
Thank you so so so much!
KSSV
KSSV 2020 年 9 月 28 日
Thanks is accepting the answer... :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by