Closed YingboMa closed 1 year ago
using EasyModelAnalysis @variables t x(t) @parameters p D = Differential(t) eqs = [D(x) ~ p * x] @named sys = ODESystem(eqs) prob = ODEProblem(sys, [x => 0.01], (0.0, Inf), [p => 1.0]) opt_tspan, (s1, s2, s3), ret = optimal_threshold_intervention(prob, [p => -1.0], x, 3, 50); plot(s1, lab = "pre-intervention") plot!(s2, lab = "intervention") plot!(s3, xlims = (0, s3.t[end]), ylims = (0, 5), lab = "post-intervention", dpi = 300)