Teljes Matlab script kiegészítő függvényekkel.
file: ccs2017_hf2_mo.m author: Peter Polcz <ppolcz@gmail.com>
Created on 2017. October 04. Reviewed on 2017. October 30.
┌d2017_10_26_hf2_mo │ - Persistence for `d2017_10_26_hf2_mo` reused (inherited) [run ID: 9200, 2017.10.30. Monday, 18:38:05] │ - Script `d2017_10_26_hf2_mo` backuped
A = [
-6 0 0
4 0 0
2 0 0
];
B = [ 1 ; 0 ; 0 ];
C = [ 0 0 1 ];
On = obsv(A,C)
Cn = ctrb(A,B)
rank(On)
rank(Cn)
orth(sym(Cn))
null(sym(On))
Hs = minreal(tf(ss(A,B,C,0)))
syms s t
clear H
H(s) = simplify(C/(s*eye(3) - A)*B)
h(t) = ilaplace(H)
disp 'NEM BIBO STABIL'
On =
0 0 1
2 0 0
-12 0 0
Cn =
1 -6 36
0 4 -24
0 2 -12
ans =
2
ans =
2
ans =
[ 1, 0]
[ 0, (2*5^(1/2))/5]
[ 0, 5^(1/2)/5]
ans =
0
1
0
Hs =
2
---------
s^2 + 6 s
Continuous-time transfer function.
H(s) =
2/(s*(s + 6))
h(t) =
1/3 - exp(-6*t)/3
NEM BIBO STABIL
a = 3;
b = 2;
c = 1;
d = 2;
n = a+b+c+d;
r = 1;
m = 1;
A_ = [
randn(a,a) zeros(a,b) randn(a,c) zeros(a,d)
randn(b,a) randn(b,b) randn(b,c) randn(b,d)
zeros(c,a) zeros(c,b) randn(c,c) zeros(c,d)
zeros(d,a) zeros(d,b) randn(d,c) randn(d,d)
];
B_ = [
randn(a,r)
randn(b,r)
zeros(c,r)
zeros(d,r)
];
C_ = [
randn(m,a) zeros(m,b) randn(m,c) zeros(m,d)
];
D = zeros(m,r);
System $(\bar A, \bar B, \bar C, D)$ is in Kalman decomposed form. The transfer function is reducible to a 3rd order system.
sys = ss(A_,B_,C_,D);
H = minreal(tf(sys))
H =
5.27 s^2 + 1.079 s + 9.61
---------------------------------
s^3 + 1.639 s^2 + 1.662 s + 3.532
Continuous-time transfer function.
Transform the system with a random transformation matrix $T$.
T = orth(rand(n));
A = T * A_ * T';
B = T * B_;
C = C_ * T';
sys = ss(A,B,C,D);
Controllability matrix
Cn = ctrb(A,B);
Transformation matrix, which generates the controllability staircase form.
[S1,~,~] = svd(Cn)
S1 =
Columns 1 through 7
0.1851 -0.1260 0.6605 0.3331 -0.0259 0.0654 -0.4868
-0.4454 -0.3309 0.5066 0.1294 0.0792 -0.0298 0.6392
0.0858 0.5118 0.3553 -0.5421 0.5260 -0.0505 0.0978
-0.3697 0.2123 0.3263 -0.3468 -0.5290 0.1723 -0.2998
-0.7716 0.1020 -0.2560 0.0252 0.1330 -0.0619 -0.2651
0.0504 0.6169 0.0561 0.3454 -0.4374 -0.4296 0.2901
-0.1453 0.1048 0.0647 0.3751 0.4385 -0.4544 -0.2988
-0.0656 0.4070 -0.0381 0.4444 0.1876 0.7535 0.1060
Column 8
-0.4009
0.0543
-0.1472
0.4383
-0.4860
-0.1854
0.5788
0.1302
The transformation.
A1 = S1' * A * S1
B1 = S1' * B
C1 = C * S1
A1 =
Columns 1 through 7
-1.8089 0.6452 0.1483 1.5986 0.8907 0.0490 0.1295
-0.1648 -0.3673 -2.1454 0.5573 0.3674 0.7582 -0.6061
0.1214 0.9705 0.5429 -1.3994 -0.7883 -0.6553 0.0855
-0.0008 -0.0089 0.0035 -0.1199 -1.3464 0.8948 0.0355
0.0020 0.0121 0.0126 0.2101 0.4802 -0.8108 -0.1284
0.0000 0.0000 0.0000 -0.0000 0.0000 -2.4875 0.2476
-0.0000 -0.0000 -0.0000 0.0000 -0.0000 0.1428 1.3063
-0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.1130 0.0064
Column 8
-0.7829
0.3596
-0.4607
0.0171
-0.3724
0.2728
-0.7555
0.5906
B1 =
-0.2095
1.3140
0.1525
2.5173
0.2153
0.0000
0.0000
0.0000
C1 =
Columns 1 through 7
-1.3935 0.0503 0.0561 1.7861 1.8917 0.0022 0.3711
Column 8
-0.3938
Order of the controllable subsystem
ab = rank(Cn);
2.1. Observability staircase form of the controllable subsystem
On1 = obsv(A1(1:ab,1:ab), C1(:,1:ab));
[~,~,S21] = svd(On1);
2.2. Observability staircase form of the uncontrollable subsystem
On2 = obsv(A1(ab+1:end,ab+1:end), C1(:,ab+1:end));
[~,~,S22] = svd(On2);
Second transformation matrix to generate the observability staircase form for both controllable and uncontrollable subsystems.
S2 = blkdiag(S21, S22)
S2 =
Columns 1 through 7
0.5406 -0.2665 -0.3286 -0.5400 0.4870 0 0
-0.1069 0.3103 0.6597 -0.0538 0.6740 0 0
-0.1265 0.8059 -0.2901 -0.4789 -0.1454 0 0
-0.5703 -0.0446 -0.5775 0.2685 0.5168 0 0
-0.5958 -0.4258 0.1979 -0.6357 -0.1429 0 0
0 0 0 0 0 -0.0042 0.9914
0 0 0 0 0 -0.6858 -0.0978
0 0 0 0 0 0.7278 -0.0865
Column 8
0
0
0
0
0
-0.1305
-0.7212
-0.6804
Transformation
A2 = round(S2' * A1 * S2,10)
B2 = round(S2' * B1,10)
C2 = round(C1 * S2,10)
A2 =
Columns 1 through 7
-1.7228 0.0510 0.0959 0 0 -0.2628 0
1.6409 0.2415 0.8973 0 0 0.1467 0
-0.3040 -2.1160 -0.1580 0 0 0.7482 0
1.3084 -0.3290 -0.6989 0.0519 -0.1450 0.6167 0.9176
-1.0943 -0.9964 -0.0245 1.5653 0.3143 0.2081 1.2303
0 0 0 0 0 1.3011 0
0 0 0 0 0 0.1434 -2.5055
0 0 0 0 0 0.7488 0.2298
Column 8
0
0
0
-0.7288
0.0807
0
0.0408
0.6139
B2 =
-1.8370
0.3824
-0.5197
0.5085
2.0316
0
0
0
C2 =
Columns 1 through 7
-2.9116 -0.4531 -0.1822 0 0 -0.5412 0
Column 8
0
Using minreal the transfer function which generates the Kalman decomposition can be retained easily, however, this does not work all the times. The uncontrollable subsystem is not always decomposed (since the uncontrollable subsystem is already redundant).
[H,U] = minreal(sys);
A1 = round(U*A/U,10)
B1 = round(U*B,10)
C1 = round(C/U,10)
5 states removed.
A1 =
Columns 1 through 7
-1.1425 -1.6553 0.2030 0 0 0.5666 -0.5119
-0.0107 0.0245 2.5022 0 0 -0.1765 0.1594
0.5187 -0.4917 -0.5213 0 0 0.0771 -0.0697
-0.2197 0.4070 1.4025 0.3210 -1.5640 -0.0442 0.2659
-1.3625 -0.2481 0.6331 0.1463 0.0452 0.8996 0.0772
0 0 0 0 0 0.6169 0
0 0 0 0 0 -0.7573 1.3011
0 0 0 0 0 -0.1920 -0.0812
Column 8
0
0
0
1.2256
-0.9628
0
0
-2.5085
B1 =
0.7434
1.1530
-1.3816
-2.0339
0.4989
0
0
0
C1 =
Columns 1 through 7
1.2907 0.6553 -2.5731 0 0 -0.4015 0.3628
Column 8
0
End of the script.
└ 0.47728 [sec]