Is it possible to adjust the maximum step size ('MaxStep') while an ode15i solver is running according to a certain value?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone, hi Matlab-Support-Team,
I've built up a quite complexe set of differential algebraic equations. I used also some 'heaviside' and 'rectangularPulse' functions, to change equation with reagrd to changing values. Unfortunately this opens some numeric troubles, since a certain value or its derivative can change abruptly, which might cause a non-stabile solver afterwards.
I thought about two tasks which might help:
- building kind of a time dependant ramp, which smoothes the course of a value or its derivative
- reducing the maximum step size 'MaxStep' while the ode15i solver is running.
However both ways did not work out to my pleasure, since there are still boundary conditions, which causes these numerical mistakes. Could you give me a few hints in general, please?
Thank you very much in advance.
Have a nice weekend.
Lukas
0 件のコメント
採用された回答
Steven Lord
2022 年 8 月 19 日
If you know the times at which you want to change functions and/or initial conditions ahead of time, run ode15i repeatedly for small pieces of the time step. So for example run ode15i from time t = 0 to time t = 2, change functions and/or ICs, then run ode15i a second time from time t = 2 to time t = 5. Change, run, change, run, etc.
If you don't know the times at which you want to change functions and/or initial conditions, use the Events functionality. The ballode example is the standard one that I recommend as a model. That example doesn't hard code when the ball will reach the ground, it detects when the ball's height above the ground crosses through 0.
その他の回答 (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!