Is it possible to adjust the maximum step size ('MaxStep') while an ode15i solver is running according to a certain value?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lukas Siebler
am 19 Aug. 2022
Kommentiert: Lukas Siebler
am 19 Aug. 2022
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 Kommentare
Akzeptierte Antwort
Steven Lord
am 19 Aug. 2022
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.
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!