How can I integrate a set of ODEs given that my initial conditions also change (linearly) within the concerned time span?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
2 Commenti
Risposta accettata
Torsten
il 6 Apr 2016
Modificato: Torsten
il 6 Apr 2016
function driver
tstart = 0.0;
tend = 1.0;
flag = 1;
[T1 Y1] =ode45(@(t,y)myfun(t,y,flag),[tstart tend],[0.01;600]);
tstart = 1.0;
tend = 2.0;
flag = 2 ;
[T2 Y2] = ode45(@(t,y)myfun(t,y,flag),[tstart tend],[Y1(end,1);Y1(end,2)]);
tstart = 2.0;
tend = 10.0;
flag = 3 ;
[T3 Y3] = ode45(@(t,y)myfun(t,y,flag),[tstart tend],[Y2(end,1);Y2(end,2)]);
function myfun(t,y,flag)
if flag==1
yin = 0.01;
Tin = 600;
elseif flag==2
yin = 0.01+(t-1)*0.02;
Tin = 600+(t-1)*100;
elseif flag==3
yin = 0.03;
Tin = 700;
end
...
Best wishes
Torsten.
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!