How can I integrate a set of ODEs given that my initial conditions also change (linearly) within the concerned time span?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Akzeptierte Antwort
Torsten
am 6 Apr. 2016
Bearbeitet: Torsten
am 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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!