How to make ode15s not to cross zero?
6 views (last 30 days)
Steven Lord on 6 Jul 2018
Does your problem involve a mass matrix? If not, use the NonNegative option as shown in the Knee Problem example on this documentation page.
If your problem does involve a mass matrix, use an Events function as shown in the bouncing ball example and the three body problem example on this documentation page. In this case you'll need to stop the solver, recompute what the new "initial" conditions should be, determine if the differential equations themselves change, and restart the solver. In the case of the bouncing ball, the ballode.m file recomputes the initial conditions at each bounce to reflect the ball rebounding from the floor.