Solvind ODE with sudden change od dy/dt function
5 次查看(过去 30 天)
显示 更早的评论
Hi all, I have a problem. I am trying to solve an ODE with ode45, but the dy/dt function has to change abruptly at a certain time t_intermediate. How do you treat this problem? If I try to use two solver and pass to the second the last solution of the first one the solution seems not to be correct.
Is there a way to manage this?
Thanks!
1 个评论
Teja Muppirala
2012-5-21
Just as another suggestion, are you also familiar with Simulink? It is my experience that Simulink out-of-the-box can generally handle these sorts of problems easier than MATLAB.
But if you want to do it with ODE45, I think Jan has the right idea.
回答(1 个)
Jan
2012-5-21
ODE45 requires a smooth function. Discontinuos changes of dy/dt let ODE45 reduce the stepsize until the rounding error exceeds the error caused by the jump. Finally the accumulated rounding errors will dominate the result.
Therefore you have to integrate from t_0 to t_intermediate and use the intermediate results as initial values of the integration from t_intermediate to t_end using the modified function.
It would be nice if the event functions are powerful enough to trigger such a change of the parameters, but they aren't.
另请参阅
类别
在 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!