0% found this document useful (0 votes)
31 views13 pages

Chap 13 Examples

The document describes decomposing a non-controllable system into controller canonical form and observable canonical form. It provides examples of determining controllability and observability of single and multiple input systems using the ctrb and obsv functions. The key steps are using these functions to find a transformation matrix, inverting it to transform the system matrices A and B (or C for observability) into controller/observer canonical form. Rank tests on the transform matrices are used to determine properties of the original system.

Uploaded by

Umair Zulfiqar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views13 pages

Chap 13 Examples

The document describes decomposing a non-controllable system into controller canonical form and observable canonical form. It provides examples of determining controllability and observability of single and multiple input systems using the ctrb and obsv functions. The key steps are using these functions to find a transformation matrix, inverting it to transform the system matrices A and B (or C for observability) into controller/observer canonical form. Rank tests on the transform matrices are used to determine properties of the original system.

Uploaded by

Umair Zulfiqar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

1.

Decomposition of non-controllable system


>> A = [1 2 -1 -1;-1 -2 0 -1;-1 -1 0 2; 1 1 -1 -3], B=[1;1;-1;1]
A=
[

-1

-1

-1

-2

-1

-1

-1

-1

-3]

B=

1
1
-1
1]

>> W = ctrb(A,B), rank(W)

W=
[

-5

-4

-4

-1

-2

-1

ans =3

2]

>> rank(W(:,1:2))
ans = 2
>> rank(W(:,1:3))
ans =3
>> rank(W(:,1:4))
ans = 3

>> p4 = [0;0;0;1]

p4 =
[

0
0
0
1]

>> P = [W(:,1:3) p4] , rank(P)


P=
[

-5

-4

-1

-1

1]

ans =

>> PI = inv(P)
PI =
[ 2.0000 1.5000 2.5000

3.0000 2.0000 5.0000

2.0000 1.5000 3.5000

1.0000 1.0000 ]

>> A_hat = PI*A*P

A_hat =
Controb Part

-0.0000

-1.0000 1.5000

1.0000 0.0000 -3.0000 5.0000


-0.0000 1.0000 -3.0000 3.5000
0

>> B_hat = PI*B

B_hat =
1
0
0
0

Uncontrob
Part
-1.0000

2. Controller Canonical Form


Single input system
>> A = [1 2 3 4; 0 1 0 3; 1 0 0 2; 1 -2 1 -1], B = [1; -1 ; 2; -2]
A=
1
0
1
1

2
1
0
-2

3
0
0
1

4
3
2
-1

B=
1
-1
2
-2
>> W = ctrb(A,B), rank (W)
W=
1 -3 2 67
-1 -7 14 17
2 -3 11 4
-2 7 1 -16

ans = 4

>> M = inv(W)
M=
0.0174
0.0423
0.0024
0.0165

-0.2226
-0.0676
0.0222
-0.0004

0.2885
0.0672
0.0579
-0.0030

-0.0915
0.1222
0.0480
0.0054

% Extracting 4th row , This is valid for any choice of row of M


>> Mn= M(4,:)
Mn =
0.0165 -0.0004 -0.0030 0.0054
>> PI = [Mn; Mn*A; Mn*A^2; Mn*A^3]
PI =
0.0165
0.0189
0.1272
0.4344

-0.0004
0.0218
-0.0473
-0.1874

-0.0030
0.0549
0.1100
0.5787

0.0054
0.0534
0.1972
0.3896

-4.0000
-6.0000
-5.0000
9.0000

1.0000
-1.0000
2.0000
-2.0000

>> P = inv(PI)
P=
64.0000
44.0000
-21.0000
-19.0000

1.0000
25.0000
6.0000
2.0000

>> AH = PI*A*P
AH =
0
-0.0000
0.0000
13.0000

1.0000
-0.0000
0.0000
13.0000

-0.0000
1.0000
-0.0000
4.0000

0.0000
0.0000
1.0000
1.0000

>> BH = PI*B
BH =
0.0000
-0.0000
0.0000
1.0000
CH = [1 0 0 0], D =0;
>> [b,a]=ss2tf(AH,BH,CH,D)
b=
0

1.0000

a=
1.0000 -1.0000 -4.0000 -13.0000 -13.0000

H(s) =
1
S^4-S^3-4s^2-13s-13

3. Controller Canonical Form


Multiple input system
>> A = [-11 13 -7 -7 -15 21; 0 -1 6 4 0 -1; -3 1 3 2 -4 2; 6 -1 3 -2 8 -2; 8 -10 5 5 11 -16; 0 1 -3 -2 0 1]
A=
-11
0
-3
6
8
0

13
-1
1
-1
-10
1

-7
6
3
-3
5
-3

-7
4
2
-2
5
-2

-15
0
-4
8
11
0

21
-1
2
-2
-16
1

>> B = [3 8 -1; 0 0 0; 1 -1 0; -1 1 0; -2 -6 1; 0 0 0]
B=
3 8 -1
0 0 0
1 -1 0
-1 1 0
-2 -6 1
0 0 0
>> % Is (A,B) Controllable?? Is B full rank???
>> W = ctrb(A,B), rank (W), rank(B)

W=
3
0

8 -1 -3 2 -4
0 0 2 -2 0

1 -1

0 -1 -1

-1

-2 -6

2 -2

0 -1

1 3 -8 29 -2
3 -1 2 0 -5

3 39 -38 10 56 -70 16
1 1 -3
1 3 -1 5

2 -4 -3 -1 -4
3 -1 -2
0 -1

-5

6 -1 -5

6 -22

0 -1

4 -6
8

1 10 -7
0 -17

-1 -1 -2

rank (W) = 6, rank(B)= 3


>> rank(W(:,1:4)), rank(W(:,1:5)), rank(W(:,1:6))

4
ans =
5
ans =
5
>> % roh_3 = 1, AB3
>> rank(W(:,1:7)) = 6
>> rank(W(:,1:8)) =6
>> % roh_2 = 2, A^2B2

9 -8

2 -2 -31 29 -8 -44 55 -13

ans =

ans =

>> % roh_1 = 6 - roh_2 - roh_3


>> % 6 -2-1 = 3; roh_1 = 3
>> Wa = [B(:,1) A*B(:,1) A^2*B(:,1) B(:,2) A*B(:,2) B(:,3)]
Wa =
3
0
1
-1
-2
0

-3
2
0
1
2
-1

1 8 2 -1
3 0 -2 0
3 -1 -1 0
-4 1 1 0
-1 -6 -2 1
-1 0 1 0

>> M = inv (Wa)


M=
0.3333
0
0
0.3333
-0.0000
2.6667

-0.3333
1.0000
1.0000
0.6667
2.0000
6.3333

1.6667
1.0000
0
-0.3333
1.0000
1.3333

1.0000
1.0000
0
0.0000
1.0000
2.0000

0.3333
0
0
0.3333
-0.0000
3.6667

0.0000
2.0000
2.0000
1.0000
5.0000
14.0000

PI = [M(3,:);M(3,:)*A; M(3,:)*A*A; M(5,:); M(5,:)*A; M(6,:)]


PI =
0
0
0
-0.0000
3.0000
2.6667

1.0000
1.0000
0
2.0000
3.0000
6.3333

0
0
3.0000
1.0000
-3.0000
1.3333

0
0
2.0000
0
0
1.0000
2.0000
0
0
1.0000 -0.0000 5.0000
-2.0000 4.0000 3.0000
2.0000 3.6667 14.0000

>> P = inv(PI)
P=
-28.0000
-1.0000
6.0000
-9.0000
21.0000
1.0000

-9.0000
2.0000
-2.0000
3.0000
6.0000
-1.0000

3.0000
0
1.0000
-1.0000
-2.0000
0

40.0000 11.0000 -12.0000


0
0
0
-2.0000 0.0000 -0.0000
3.0000 -0.0000 0.0000
-30.0000 -8.0000 9.0000
0
0
0

>> AH = PI*A*P
AH =
0
-0.0000
1.0000
0
9.0000
6.6667

1.0000
0
-3.0000
0.0000
4.0000
0.0000

0
1.0000
2.0000
0.0000
-0.0000
0.0000

>> BH = PI*B
BH =
0
0
1.0000
0
0
-0.0000

0
0
0
0
-1.0000
0
0.0000 -0.0000
1.0000 1.0000
0.0000 1.0000

0
0
0
0.0000
0
0
0.0000
1.0000 0.0000
0.0000
1.0000
0
-11.0000 -4.0000 3.0000
-10.3333
0
3.0000

4. Observable Canonical Form


Signle Ouput
>> A = [1 2 3 4; 0 1 0 3; 1 0 0 2; 1 -2 1 -1]
A=
1
0
1
1

2
1
0
-2

3
0
0
1

4
3
2
-1

>> C = [1 -1 2 -2]
C=
1

-1

-2

>> O = obsv(A,C)
O=
1 -1 2 -2
1 5 1 7
9 -7 10 14
33 -17 41 21
>> J = inv(O)
J=
-2.7632
-0.1842
2.0263
0.2368

-0.4211
0.1053
0.3421
0.0789

-0.6336
-0.1397
0.3826
0.1356

0.2996
0.0405
-0.1761
-0.0466

>> Jn = J(:,4)
Jn =
0.2996
0.0405
-0.1761
-0.0466
>> PI= [Jn A*Jn A*A*Jn A*A*A*Jn]
PI =
0.2996
0.0405
-0.1761
-0.0466

-0.3340
-0.0992
0.2065
0.0891

0.4433
0.1680
-0.1559
-0.0182

0.2389
0.1134
0.4069
-0.0304

1.0000
1.0000
-1.0000
2.0000

5.0000
15.0000
9.0000
-2.0000

>> P = inv(PI)
P=
7.0000
4.0000
0.0000
1.0000

-17.0000
-8.0000
6.0000
-1.0000

>> AH = P * A * PI

AH =
0.0000
1.0000
-0.0000
0.0000

-0.0000
-0.0000
1.0000
-0.0000

0.0000
0.0000
0.0000
1.0000

13.0000
13.0000
4.0000
1.0000

>> CH = C*PI
CH =
-0.0000 -0.0000 0.0000 1.0000

You might also like