You cannot be changing the parameters of the system within the dynamical rule. The very definition of a parameter is that it does not change in time. Everything that is changing inside the dynamical rule must be a state variable, i.e., a component of u
. You need to adjust your logical approach to the problem accordingly.
Alternatively, you can change system parameters in-between steps of the model. This can be done either via the callback system of DifferentialEquations.jl (Event Handling and Callback Functions ยท DifferentialEquations.jl ) or by simply calling the function set_parameter!
inbetween calls to step!(ds::DynamicalSystem, t::Real)
.