how to choose appropriate ode solver and set appropriate maxstep, RelTol etc. parameters
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello; Do you have some kind of tutorial for selecting and setting ode solver for accurate calculation in Matlab? Also, I wonder If there are a methodology to set optimum RelTol, maxstep size etc. options.
1 comentario
Torsten
el 21 de Jun. de 2018
Most of it is trial and error.
Just set up your problem and start with the standard options.
Best wishes
Torsten.
Respuestas (1)
Jan
el 21 de Jun. de 2018
There is no "optimal" value for the tolerances and maximum step size. It depends on what you need. With higher tolerances, you get a faster integration, larger discretization errors and less accumulated rounding errors. With lower tolerances the ODE is discretized more accurately, but with the higher number of steps the run time and the accumulated rounding error increases.
The stepsize controller determines the step sizes such, that an optimum between local discreatization error and accumulated rounding error is found - for the specified tolerances. If the tolerances are too small, the cancellation error will dominate the accuracy. As a rule of thumb ODE45 is exhausted for a relative tolerance of 1e-12, but remember that only the component of the trajectory controls the step size, which have the largest influence.
It is useless to run an integration with a tiny tolerance, if the initial position and the parameters are known with a low accuracy only. I've sen many "accurate" integrations of equations of motion with a relative tolerance of 1e-12, which use the very rough value of 9.81 as gravitational acceleration or 3.14 to approximate pi.
An integration without an analyses of the sensitivities is not reliable at all: If the physical system is instable, the result can be dominated by rounding or discreatization errors. If you e.g. simulate a pen standing on its tip, you might get the result, that it will not move. But this is not a realistic simulation. You have to vary the initial positions and parameters inside the known physical limits and check the deviation of the final position. Then adjusting the tolerances to get a more accurate result becomes a meaningful questions - but as said already: it depends on the function to be integrated and on your demands.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!