Given ODE:
$\dot{x}=-2 e^{-x^2} x + U$
where:
$U=-u_{as}$
$u_{as} = \begin{cases} \frac{e}{\psi_+-e}, & \mbox{if } e\mbox{>=0} \\ \frac{e}{e-\psi_-}, & \mbox{if } e\mbox{<0} \end{cases}$
$e=x$
$\psi_+=\frac{1-\delta}{T \cdot t+1}+\delta$
$\psi_-=-\frac{0.5+\delta}{3T \cdot t+1}-\delta$
There is my code:
(***)
Clear["Derivative"]
ClearAll["Global`*"]
pars = {xs = -1/4, xe = 1, T = 5, \[Delta] = 0.1}
e = x[t]
\[Psi]plus = (1 - \[Delta])/(T t + 1) + \[Delta]
\[Psi]minus = -(1/2 + \[Delta])/(3 T t + 1) - \[Delta]
uas = Piecewise[{{e/(\[Psi]plus - e), e >= 0}, {e/(e - \[Psi]minus),
e < 0}}]
U = -uas
sys = NDSolve[{x'[t] == -2 E^-x[t]^2 x[t] + U, x[0] == xs}, {x}, {t,
0, 3}]
Plot[{Evaluate[x[t] /. sys], \[Psi]plus, \[Psi]minus}, {t, 0, 3},
PlotRange -> Full, PlotPoints -> 100]
Plot[{Evaluate[U /. sys]}, {t, 0, 1}, PlotRange -> Full,
PlotPoints -> 100]
When I run NDSolve
, I get a error on the 3rd second of the calculation.
`NDSolve::smpf: Failure to project onto the discontinuity surface when computing Filippov continuation at time 2.359060463990643.
I want to understand what the reason for this error is and how to avoid it in the numerical calculations.
I would be grateful for the help.
t=2.35
. Decrease the range{t, 0, 2.35}
andNDSolve
evaluates without error message $\endgroup$Method -> {"DiscontinuityProcessing" -> False}
. But I still did not understand what was the reason for the error. $\endgroup$AccuracyGoal -> 32
or evenAccuracyGoal -> Infinity
. $\endgroup$Piecewise
. But the vector field changes continuously as crosses the equilibrium $x=0$. I suspect it's this singularity in the vector field at the boundary between the pieces that leads to the failed projection. (RaisingAccuracyGoal
keeps the numerical solution from crossing the boundary, and the true solution does not cross it either.) $\endgroup$