Hi,
You need to take special care when your system of ODEs contains a step change, like a Heaviside function. These can be handled with MATLAB's ode solvers (like ode45), but you should use "events" to restart the ODE solver after a step change. Take a look at the bouncing ball example file ballode.m, or see this documentation page: href = "http://www.mathworks.com/help/matlab/math/ordinary-differential-equations.html#f1-6696>8">http://www.mathworks.com/help/matlab/math/ordinary-differential-equations.html#f1-6696>8</a
-Arthur
