Reputation: 344
I want to solve a differential equation that has some "silence period" (I'm not sure whether it has a formal name or not, it means during this period that the system is static and not controlled by the differential equation).
For example (see the figure), when a free-fall ball touches the ground, the callback function will be triggered. It enters this "silence period" (dash line in the figure), after this period, it keeps following the differential equation (the parameters can be change or not, as in the figure I reset the height of the ball).
I know it can be done by for loop, but currently I try to use DifferentialEquations.jl, so I wonder if I can set a callback or use other methods to accomplish it?
Thank you in advance!
Upvotes: 0
Views: 102
Reputation: 19152
The simplest way to do this is to set a parameter to zero using a DiscreteCallback
, and having a second callback un-zero it. The callback handling page describes in more detail how to define and use such callbacks.
Upvotes: 1