how could i animate this?

1 visualizzazione (ultimi 30 giorni)
HADIMARGO
HADIMARGO il 17 Dic 2018
Commentato: madhan ravi il 18 Dic 2018
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 Commenti
HADIMARGO
HADIMARGO il 17 Dic 2018
that is right!
madhan ravi
madhan ravi il 18 Dic 2018
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

Accedi per commentare.

Risposta accettata

KSSV
KSSV il 18 Dic 2018
Modificato: KSSV il 18 Dic 2018
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

Più risposte (0)

Categorie

Scopri di più su Animation in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by