You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here I create a continuous callback that should add 20 units of X whenever X hits the threshold at 50.0. Practically, the about of X added seems a bit random, and typically less that 20.0.
using ModelingToolkit
@variables t X(t)
@parameters p d
D =Differential(t)
eqs = [D(X) ~ p - d*X]
noiseeqs = [0.1*X]
continuous_events =[[X ~50.0] => [X ~ X +20.0]]
@named ssys =SDESystem(eqs, noiseeqs, t, [X], [p, d]; continuous_events)
ssys =complete(ssys) # because @mtkbuild/structural_simplify are broken for SDE systems.
u0 = [X =>55.0]
tspan = (0.0, 100.0)
ps = [p =>10.0, d =>0.2]
oprob =SDEProblem(ssys, u0, tspan, ps)
sol =solve(oprob, ImplicitEM())
plot(sol)
The text was updated successfully, but these errors were encountered:
Here I create a continuous callback that should add
20
units ofX
wheneverX
hits the threshold at50.0
. Practically, the about ofX
added seems a bit random, and typically less that20.0
.The text was updated successfully, but these errors were encountered: