I have a nonlinear control system
system = {x'[t] == u[t] m[t],
WhenEvent[And[Mod[t, 9], x[t] < 100], m[t] -> x[t]],
WhenEvent[u[t] == 0, m[t] -> 10], x[t /; t <= 0] == 0,
m[t /; t <= 0] == 1, u[t /; t <= 0] == 0};
control = {e[t] == xref - x[t],
WhenEvent[Mod[t, \[Tau]],
u[t] -> kp (k1 Sign[e[t]] - k2 Sign[e'[t]])],
e[t /; t <= 0] == xref};
params = {kp -> 1, td -> 1, \[Tau] -> 0.5, xref -> 810, k1 -> 11/2, k2 -> 9/2};
which I simulate using NDSolve
sol = NDSolve[{system, control} /. params, {x, m, u}, {t, 0, 60},
DiscreteVariables -> {u, m}];
I would like to add random noise to the system, but so far nothing seems to work. Using RandomReal[NormalDistribution[]]
is problematic, as it only samples once for NDSolve
. Using WienerProcess
with ItoProcess
also does not seem to work, as the system contains discrete variables. I cannot convert it to a state space model, as StateSpaceModel
only works for linear systems.
x'[t] == u[t] m[t] + rn[t]
? $\endgroup$