How can I integrate a set of ODEs given that my initial conditions also change (linearly) within the concerned time span?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
2 commentaires
Réponse acceptée
Torsten
le 6 Avr 2016
Modifié(e) : Torsten
le 6 Avr 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 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!