Laboratory in Automatic Control Lab11

You might also like

Download as ppt or pdf
Download as ppt or pdf
You are on page 1of 15

Laboratory in Automatic Control

LAB 11
System Design Using State Space Methods
eig Function
Find eigenvalues and eigenvectors
Syntax
D=eig(A)
[V,D]=eig(A)
where D is eigenvalues of A and V is eigenvectors of A

Example: Consider the model of second-order system is



2 0 0
0 5 1
x x u
( (
= +
( (

eig Function
Hand calculation





MATLAB code

( )
1 2
2 0
det det 0
0 5
2 and 5
s
sI A
s
s s
| |
(
= =
|
(


\ .
= =
A=[2 0;0 5];
D=eig(A)
eig Function
Form the controllability matrix (ctrb)
Form the observability matrix (obsv)
Syntax
Pc=ctrb(A,B)
Po=obsv(A,C)
Pc=ctrb(sys)
Po=obsv(sys)

ctrb and obsv Function
Example: Consider the system given by



The system controllability matrix Pc is



The system observability matrix Po is

| |
2 0 1
1 1 1
1 1
x x u
y x
( (
= +
( (


=
| | ( )
1 2
det 0 uncontrollable
1 2
C C
P B AB P
(
= = =
(


( )
1 1
det 0 unobservable
1 1
O O
C
P P
CA
( (
= = =
( (

x Ax Bu
y Cx
= +

ctrb and obsv Function


MATLAB code
A=[2 0;-1 1];B=[1; -1];C=[1 1];
Sys=ss(A,B,C,[0]);
% Controllability of system
Pc=ctrb(A,B)
% or Pc=ctrb(Sys);
dtPc=det(Pc)
% Observability of system
Po=obsv(A,C)
% or Po=obsv(Sys);
dtPo=det(Po)
acker Function
Pole placement design for single-input systems
Syntax
K=acker(A,B,p) -------- Controller Gains for A-BK
L=acker(A,C,p) --------- Observer Gains for A-LC




Example: Consider the model of second-order system is


0 1 0
0 0 1
x x u
( (
= +
( (

K=acker(A,B,P) calculates the feedback gain matrix

with a feedback law of has closed loop poles
at the values specified in vector
K
x Ax Bu
u Kx
P
= +
=
acker Function
Determine a controller gain matrix to place the closed-loop
system poles at




MATLAB code


1 2
1
,
s j =
1
1
j
p
j
+
(
=
(


A=[0 1;0 0];
B=[0;1];
p=[-1+i;-1-i];
K=acker(A,B,p)
acker Function
Example: Consider another model of second-order system
is



Determine a observable gain matrix to place the closed-loop
system poles at


| |
2 3 0
1 4 1
1 0
x x u
y x
( (
= +
( (


=
1 2
8 6
,
s j =
8 6
8 6
j
p
j
+
(
=
(


acker Function
MATLAB code
A=[2 3;-1 4];
C=[1 0];
p=[-8+6i;-8-6i];
L=acker(A,C,p);
L=L
State Variable Compensator
The system is



The observer can be represented
as


In matrix form:

( )
x Ax Bu L y Cx = + +

x Ax Bu u Kx
y Cx
= + =
=

,
x
A BK x
LC A BK LC x
x
(
( (
=
(
( (



c
A
0
x A BK BK x
e A LC e
e x x

( ( (
=
( ( (


=

State Variable Compensator
Consider the third-order system







Simulate the closed-loop system with the initial state conditions
the initial state estimate of
| | | |
0 1 0 0
0 0 1 0
4 3 1 7 6 7 3 5
0 1 0 0
. . . .
x x u
y u
( (
( (
= +
( (
( (


= +
| | | |
10 11 22 34 5 43 1622 49 737
T
K L = = . . . ,
( ) | |
0 2 0 0
T
x =
( ) | |
0 0 5 0 2 0 2
T
x = . . .
State Variable Compensator
MATLAB code
A=[0 1 0;0 0 1;-4.3 -1.7 -6.7];B=[0;0;0.35];
C=[0 1 0];D=[0];
K=[10.11 22.34 -5.43];L=[-1622 49 737]';
Ac=[A -B*K; L*C A-B*K-L*C];
Bc=zeros(6,1);
Cc=eye(6);
Dc=zeros(6,1);
sys=ss(Ac,Bc,Cc,Dc);
x0=[2;0;0;0.5;0.2;0.2];t=[0:0.01:4];
[y,t]=initial(sys,x0,t);
subplot(311),plot(t,y(:,1),t,y(:,4),'--')
subplot(312),plot(t,y(:,2),t,y(:,5),'--')
subplot(313),plot(t,y(:,3),t,y(:,6),'--')
xlabel('time(s)'); ylabel('response')
legend('true data','estimated data',0)
State Variable Compensator

Lab 11 Homework
Consider the system




(a) Is the system stable? (using eig function)
(b) Is the system controllable? (using ctrb function)
(c) Is the system observable? (using obsv function)
(d) Using the acker function, determine a full-state feedback gain
matrix and the observe gain matrix to place the closed-loop system
poles at and the observer poles at
(e) Simulate the closed-loop system with the initial state conditions
the initial state estimate of

| |
0 1 0 0
0 0 1 0
4 3 1 7 6 7 0 35
0 1 0
x x u
y x
( (
( (
= +
( (
( (


=
. . . .
1 2 3
18 5 = 20 s j s =
,
,
1 2 3
1 4 1 4 = 2 s j s =
,
. . ,
( ) | |
0 1 0 0
T
x = ( ) | |
0 0 5 0 1 0 1
T
x = . . .

You might also like