How can I integrate a set of ODEs given that my initial conditions also change (linearly) within the concerned time span?
1 次查看(过去 30 天)
显示 更早的评论
2 个评论
采纳的回答
Torsten
2016-4-6
编辑:Torsten
2016-4-6
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!