how could i animate this?

4 ビュー (過去 30 日間)
HADIMARGO
HADIMARGO 2018 年 12 月 17 日
コメント済み: madhan ravi 2018 年 12 月 18 日
x=linspace(-5,5,1000);
a_n=2;
b_n=3;
l=10;
for n=1:1:10
for t=0:1:10
y=a_n*cos((n*pi*t)/l)+b_n*sin((n*pi*t)/l)*sin((n*pi*x)/l);
end
end
u=y;
plot(x,u)
  3 件のコメント
HADIMARGO
HADIMARGO 2018 年 12 月 17 日
that is right!
madhan ravi
madhan ravi 2018 年 12 月 18 日
you need to know that there are several curves created in each loop iteration but you overwrite all the values and only the end values are saved in the last iteration

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

採用された回答

KSSV
KSSV 2018 年 12 月 18 日
編集済み: KSSV 2018 年 12 月 18 日
comet(x,u)
OR
x=linspace(-5,5,1000);
a_n=2;
b_n=3;
l=10;
for n=1:1:10
for t=0:1:10
y=a_n*cos((n*pi*t)/l)+b_n*sin((n*pi*t)/l)*sin((n*pi*x)/l);
plot(x,y)
pause(0.1)
end
end

その他の回答 (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