I have a nonlinear sytem, i need to design the controller for the linearized system and then apply the same controller to the nonlinear system it self to see how it performs, i've done so, but i get totally opposite control input: -88 and + 35
this is the system:
$$\dot{x_1}= x2$$ $$\dot{x_2} = -10x_1+1.8{x_1^2}-0.25x_2-30 +u$$
the equilibrium points without any inputs $$u=0$$ are :$$(-2.16,0) , (7.71,0) $$ (stable and saddle points)
I linearize near the saddle point and get: Matrix A= \begin{bmatrix}0&1 \\ 17.75&-0.25\end{bmatrix}
$B= [0 , 1] '$ $C=[1, 0]$ (so the output is $ y=x_1 $
To design my control i use pole placement:
clc
clear all
A=[0 1;17.75 -0.25]
B=[0 1]'
C=[1 0]
D=zeros(1,1);
sys = ss(A,B,C,D);
G = tf(sys)
step(G);
PO=10;
ts=5;
zita = abs(log(PO/100))/(sqrt(pi^2 + (log(PO/100))^2)); % scelgo ts e po = sovraelongazione
wn = 4/(zita*ts);
alpha = -zita*wn;
wd = wn*sqrt(1-zita^2);
p1 = alpha + j*wd;
p2 = alpha - j*wd;
p3=10*real(p2)
Aaug = [A zeros(2, 1); -C 0];
Baug = [B;0];
Caug = [C 0];
Daug = D;
K=place(Aaug,Baug,[p1 p2 p3]);
Kp=K(1,1:2);
Ki=K(1,3);
so my control look something like: Simulink scheme of control and my y does arrive to the desired reference input. But the control input is at steady state = -88.
Now if i apply the very same control scheme to the nonlinear system: Nonlinear control scheme where the nonlinear block is just:
function xdotdot= fcndot(x,xp,u)
% define your constants
ma = -10;
maa= 1.8;
md = -0.25;
delta = -30*1;
% nonlinear set of equations
xdotdot = ma*x+maa*x*x+md*xp+delta+u
while i'm near the point i will still have Yref= y but my steady state control input is +35 what is strange is that the has opposit sign, while the error, the states and the output have more or less the same shape:
Control input linearized system---
Control input on the nonlinear sytem
why i have such difference in the input control if i have all the other thing that looks the same? it's due to an error? it is possible?
Despite both controllers are the same, the plants used in both simulations are different. Naturally, the control input $u$ at steady-state will be different as well.
If your intention is to stabilize the nonlinear system at the saddle point, then try this controller:
$$ u = \omega^2 x_{d} - 1.8 x_{1}^2 - K_{p} x_{1} - K_{d} x_{2} + 30 $$
where $x_{d}$ is the desired $x$ value at steady-state, and $\omega$ is the parameter tuned to guarantee the convergence at 5 seconds
$$ x_{d} = \frac{5}{9} (5 + \sqrt{79}) \approx 7.71 $$
$$ \omega = 1.2 $$
with the proportional gain $K_{p}$ and derivative gain $K_{d}$ designed as
$$ K_{p} = \omega^2 - 10 $$
$$ K_{d} = 2 \omega - 0.25 .$$
Note that the control input $u$ at steady-state will be $0$ if $x_{d}$ is one of the unforced equilibrium points.
If your the desired point $x_{d} = 5$, then the control input $u$ at steady-state will be $5 + 30 = 35$, which is the same result that you obtained from your pole placement feedback with integral action.