Making sure the maximum calculated value in my function is represented in ode15s output.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I've used ode15s to solve a system of ODEs and then plotted the results. However when I do that, the peak calculated value in my function (which I would like to show on my graph) is not outputted by ode15s and hence my plotted peak does not actually show the true peak value.
Due to the stiffness of my ODEs, I cannot just increase the number of values I have, so I was wondering if there is a way to output the calculated maximum point from my function while using ode15s?
Any help would be much appreciated.
3 comentarios
Piotr Balik
el 8 de En. de 2021
If you have stepwise defined derivative, how about computing ode at three intervals? Start of the following one would be the last point of the former.
Respuesta aceptada
Jan
el 9 de En. de 2021
ODE15S is designed to integrate smooth functions, as the other ODE integrators of MATLAB are. Running it with this not differentiable function replies a trajectory, which is not a "reliable result". The maximum value might be dominated by random rounding errors.
Prefer to run 3 integrations for the different time intervals using the final value of the former one as initial value for the next. After joining the trajectories you have a reliable output including the wanted maximum value.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!