Professional Documents
Culture Documents
Lab 3 State Feedback Control Design
Lab 3 State Feedback Control Design
Lab 3 State Feedback Control Design
Title
1. To study the controllability and observability
2. To study the full state feedback control design.
Apparatus
MATLAB Software
Introduction
Controllability definition: A system is said to be controllable if it is possible to derive the
system variables from given initial state X(to) to a final desired state X(tf) from a control
input vector U(t). It tells whether the state variables X (t) can be controlled (by U(t)) to
achieve the desired output)[from checking controllability matrix].
Full-state feedback control law: A control law of the form u = -Kx where x is the state of
the system assumed known at all times.
In the state variable feedback form controllability and observability can be checked using the
functions “ctrb” and” obsv”, respectively. The inputs to the ctrb function are the system
matrix A and the input matrix B; the output of ctrb is the controllability matrix Pc. Similarly,
the input to the obsv function, shown in Figure, is the system matrix A and the output matrix
C; the output of obsv is the observability matrix Po.
The controllability matrix Pc is a function only of A and B, while the observability matrix Po
is a function only of A and C.
Example: Consider the system given below check the controllability and observability of the
system.
−6 2 0 5
ẋ=
[4 0 7 x+ 0 u
−10 1 11 1 ] []
y= [ 1 2 1 ] x
Solution:
clear all,clc
A=[-6 2 0;4 0 7;-10 1 11];
B=[5;0;1];
C=[1 2 1];
Pc=ctrb(A,B);
Po=obsv(A,C)
detPc=det(Pc)
detPo=det(Po)
if detPc==0
disp('system is not controllable')
else
disp('system is controllable')
end
if detPo==0
disp('system is not observable')
else
disp('system is observable')
end
MATLAB Result:
Po =
1 2 1
-8 3 25
-190 9 296
detPc =
-84933
detPo =
-3.6030e+03
system is controllable
system is observable
Ackermann's formula for finding state-feedback gain K
Now we discussed Ackermann's formula to place the poles of the system at desired locations.
The function acker calculates the gain matrix K to place the closed-loop poles at the desired
locations. The acker function is illustrated in Figure
ẋ =Ax + Bu
and the control feedback given by
u = -Kx,
ẋ == Ax + Bu = Ax - BKx = (A - BK)x.
d3 y d2 y d1 y
+5 +3 +2 y=u
dt 3 dt 2 dt
[
ẋ= 0 0 1 x+ 0 u
−2 −3 −5 1 ] []
y= [ 1 0 0 ] x
Solution:
%Convert to tf form
[b,a] = ss2tf(A,B,C,D)
sys=tf(b,a)
pole(sys) %system actual poles
pzmap(sys)
step(sys)
%Desired poles by ackerman
P=[-0.18+0.6j;-0.18-0.6j;-2.5];
%P=[-1+j;-1-j;-5];
K=acker(A,B,P)
A_new=A-B*K; %Modified A for desired pole placement
[b1,a1] = ss2tf(A_new,B,C,D) % new TF
sys_new=tf(b1,a1)
pole(sys_new)
pzmap(sys_new)
step(sys_new)
subplot(2,1,1),pzmap(sys_new),title('sys new')
subplot(2,1,2),pzmap(sys),title('sys')
MATLAB Result
Po =
1 0 0
0 1 0
0 0 1
detPc =
-1
detPo =
1
K =
Using Simulink
Step 2: Use one of the built-in ODE solver (ode23, ode45, ...) in a Script
clear all,clc
xo=[5 0 0];
tspan = [0 20];
[t y]=ode45('mydiff',tspan,xo);
plot(t,y(:,1),'g',t,y(:,2),'r',t,y(:,3),'b')
Task:
Design the Full-State Feedback Control Law for Inverted Pendulum for settling time half
second.
• l = 0.098 m
• g=9.8 m/ s2
• m=0.825 kg
• M=8.085 kg
Observations
Conclusion