Solution
A= [■(0&1&0@0&0&1@-1&4&-3)] , B= [■(0@0@2)] C=[■(0&1&0@0&0&1)]
Pick Q [■(2000&0@0&2000)] , R=1
K=lqr(A<B,C^'*Q*C,R); K=[0.0000 47.2523 43.7714]
eig(A-B*K)={-89.5321,-0.0112,-0.9996)
MATLAB Simulink Model
Output response
2). 2) Assume that only the output is available. Design an observer so that the poles of the observer are -5+5j,-5-j5,-10. Choose the observer gain so that all the elements have absolute value less than 80. Form a closed-loop system along with the LQR controller part 1). Plot y_1 (t) and y_2 (t) in same figure for t∈[0,20]
Solution
Using approach of full dimensional estimators
G_(n-q+1)^0= [■(C@CA)]= [■(■(0&1&0@0&0&1)@■(0&0&1@-1&4&-3))]
G_(n-q+1)^0=ρ(G_(n-q+1)^0 )=3 ,observable
Given the poles of observer, -5+5j,-5-j5,-10 choose
F= [■(-5&-5&0@5&-5&0@5&5&-10)] ,L_0= [■(2&3@3&2@2&1)]
G_(n-ρ+1)^c= [L_0 FL_o ]= [■(■(2&3@3&2@2&1)&■(-25&-25@-5&5@-20&-10))]
G_(n-ρ+1)^c=3 →(F,L_o )Controllable
T=lyap(-F,A,-L_0*C); L=inv(T)*L_o;
L= [■(19.0148&-25.5544@15.1669&7.2402@-4.1955&1.8331)]
eig(A-L*C)= {-5.0000+5.0000i,-5.0000-5.0000i,-10.0000}
Simulink
Output response
Problem 3
A Cart with an inverted pendulum
The control problems are;
Stabilization: designed a feedback law u=Fx such that x(t)→0for x(0)close to origin
A). Find the matrices A, B for state space equation
(M+m) Y ̈+mI(θ ̈=u (1) ) ̈
Y ̈=1θ ̈=gθ (2)
Solving equations 1 and 2 then we get;
Y ̈=(-mg/M)θ+(1/M)u (a)
θ ̈=(g/l=mg/Ml ) θ-(1/Ml)u (b)
y=x_1,y`=x_2,θ=x_3,θ`=x_4
State space equations:
x`=Ax+Bu,y(t)=Cx+Du
Solving the equation (a), and (b) in the state space equations, we get;
A=[■(■(0&1@0&0)&■(0&0@-1.96&0)@■(0&0@0&0)&■(0&1@58.5&0))]
B= [■(■(0&0.2)&■(0&-1))]`
B). Design a feedback law u=F1x so that A+BF1 has eigenvalues at -3±j3;-6 and -8. Build a simulink model for the closed-loop linear system. Plot the response under initial condition x(0)=[-1.5,0,1,3].
Solution
F= [■(■(-1&1)&■(0&0 ; ■(■(-1&-1)&■(0&0)))) ; ■(■(0&0)&■(-2.5&0)) ; ■(■(0&0)&■(0&-5))]
F =
-1.0000 1.0000 0 0
-1.0000 -1.0000 0 0
0 0 2.5000 0
0 0 0 -5.0000
K_o= [■(■(1&0)&■(-1&1))]
K_0= ■(■(1&0)&■(-1&1))
a=K_0*F
a=■(■(-1&1)&■(2.5&-5))
b=a*F
b=■(■(0&-2)&■(-6.25&25))
c=b*F
c=■(■(2&2)&■(15.625&-125.000))
G=[K_O;a;b;c]
G= ■(■(-1&0@-1&1)&■(-1&1@2.5&-5)@■(0&-2@2&2)&■(-6.25&25@15.62&-125.00))
rank(G)= 4
A= [0 1 0 0; 0 0 -1.96 0 ;0 0 0 1;0 0 58.8 0]
A =
0 1.0000 0 0
0 0 -1.9600 0
0 0 0 1.0000
0 0 58.8000 0
B= [0; 0.2;0;-1]
B =
0
0.2000
0
-1.0000
T= lyap(A,-F,-B*K_0)
T =
0.0006 -0.0834 0.0260 -0.0057
0.0828 0.0839 0.0651 0.0284
-0.0170 0.0006 0.0190 -0.0296
0.0164 -0.0176 0.0476 0.1479
K= K_0 *inv (T)
K =
2.5510 2.0408 -52.7898 -4.0918
eig(A-B*K)
ans =
-5.0000 + 0.0000i
-1.0000 + 1.0000i
-1.0000 - 1.0000i
2.5000 + 0.0000i
Design a feedback law
Results
Simulink model for the closed-loop linear system
3). Build a Simulink model for the original nonlinear system, verify that stabilization is achieved by u=F1x when x(0) is close to the origin. Find the maximal _o so that the nonlinear system can be stabilized from x(0)=(0,0,_0,0).
Solutions
%Simulink model for nonlinear system,
function dx=ff(x)
g= 9.8;
l=0.2;
M=5;
m=0.5;
x1= x(1);x2=x(2);
x3=x(3);x4=x(4);
u=x(6);
dx2=((m*l*x4^2*sin(x3)+u)-(m*g*cos(x3)*sin(x3)))/(M+m-m*cos(x3)^2);
dx4=((g*sin(x3)+(M+m))-(cos(x3)*(u+m*1*x4^2*sin(x3))))/(1*(M+mm*cos(x3)^2));
dx=[dx2;dx4];
end
4). . For x(0)=(0,0,compare the response y(t) and (t) for the linearized system and the nonlinear system under the same feedback u=F1x.
Solution
Graph: