# Nonlinear system with time-optimal control

Given nonlinear system:

$$\begin{cases} \dot{x_1}=x_3+u \\ \dot{x_2}=-x_2+\dot{f} \\ \dot{x_3}=-x_3+x_2 \cdot \alpha \sin(\omega t) \\ \dot{x_4}=-x_4+x_2 \cdot (\frac{16}{\alpha^2}(\sin(\omega t)-\frac{1}{2})) \end{cases}$$

where, $$x_1...x_4$$ - variables;

$$f=-(x_1+\alpha \sin(\omega t))^2$$;

$$\alpha, \omega >0$$ - constants.

Problem: make variable $$x_4$$ negative in minimal time

How to formulate the criterion for the optimal time?

I would be grateful for advice and help.

EDIT There is my code, where i try to used FeedbackLinearize

Clear["Derivative"]
ClearAll["Global*"]

Needs["ParallelDeveloper"]

S[t] = \[Alpha] Sin[\[Omega] t];
M[t] = 16/\[Alpha]^2 (( Sin[\[Omega] t])^2 - 1/2);

f = -(x1[t] + S[t] - xe)^2

Parallelize[
asys = AffineStateSpaceModel[{x1'[t] == x3[t] + u[t],
x2'[t] + x2[t] == D[f, t] + x3[t], x3'[t] + x3[t] == x2[t] S[t],
x4'[t] + x4[t] == x2[t] M[t]}, {{x1[t], xs}, {x2[t], 0}, {x3[t],
0}}, {u[t]}, {(x4[t])}, t] // Simplify]

\[ScriptCapitalF] =
FeedbackLinearize[
asys, {{Subscript[z, 1], Subscript[z, 2], Subscript[z, 3],
Subscript[z, 4]}, v}];

\[ScriptCapitalF]["ResidualSystem"] // Simplify

pars = {xs = -1, xe = 1, \[Alpha] = 0.35, \[Omega] = 2 Pi*1/2, k = 100}

OutputResponse[{asys, {xs, 0, 0, 0}}, 0, {t, 0, 100}]
Plot[%, {t, 0, 100}, PlotRange -> All]

\[ScriptCapitalF]["LinearSystem"] // Simplify

\[Kappa] =
StateFeedbackGains[\[ScriptCapitalF]["LinearSystem"], {-1, -1}]

csys = \[ScriptCapitalF][{"ClosedLoopSystem", \[Kappa]}]

sr = StateResponse[{csys, {xs, 0, 0, 0}}, {0}, {t, 0, 250}];
Plot[#, {t, 0, 250}, PlotRange -> All] & /@ %[[{1, 4}]]
`

I didn't succeed, a system with such an arrangement of inputs contains a singular ResidualDynamic.

• You might get more answers for this type of thing at the Mathematics StackExchange Commented Apr 27, 2021 at 12:52
• I must disappoint you in the fact that my knowledge in non-linear control is very limited. Even though I can guess that something like $u(t) = -x_3 - x_1 + c$ where $c$ is some constant will steer $x_1$ to $c$. Knowing what $f$ looks like, this can be used to keep $x_4$ less than zero. However, I do not know how to assert any performance properties. Luckily, with your provide model, I think someone with some knowledge in non-linear control might help you. Good luck :D Commented Apr 27, 2021 at 13:38
• Have you tried to implement either input-output linearization or full state linearization ? Both considering your output to be $y = x_4$ cause you basically want to control this state. And also what does make $x_4$ negative mean ? Like $x_4 = -100$, $x_4 = -10000$ or $x_4 = -1$ ? Do you have any more specific reference for $x_4$ ? Commented Apr 27, 2021 at 18:15
• Could we maybe introduce a specific requirement for $x_4$ ? Because you want it to be negative, we can demand it to track the reference signal $r(t) = -1, \forall t > 0$ ? Commented Apr 27, 2021 at 18:30
• @TeoProtoulis 1. I tried the wolfram.com/mathematica/new-in-10/nonlinear-control-systems/…. I have not tried it separately, because I'm afraid to turn the system into a "dummy" integrator and lose its important properties. 2. Could we maybe introduce a specific requirement for $x_4$. Yes, but these must be the requirements of the species: $sign(x_4)=-1$ or $tanh(k x_4)=-1$ or $sign(x_4)+1=0$ or $tanh(k x_4)+1=0$, where $k >> 1$
– dtn
Commented Apr 27, 2021 at 18:36