Change ode time step based on state
4 views (last 30 days)
Show older comments
I have a system of ODE's that I am solving using ode45. I am simulating a dynamic system and can therfore easily determine the energy that is currently in the system. Furthermore, I can can determin the Work of the forces acting on the system. If E_0 is the initial energy at t = 0, E_t the energy in the system in the currenttime step, W is the fork done by the forces, than it should hold that E_t - E_0 - W = 0 (for there is no damping). However when I run the ode45 function and afterwards compare the energy balance, this is not nesecarily true. Only if I set the maximum time step of ode45 to a suitably small number the energies remain balanced.
To decrease computational time it would be nice to use the maximum allowable time step, whilest keeping the energies balanced. Is there a way to do this? Can I dynamically change the time step based on the energy balance?
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!