-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.m
89 lines (89 loc) · 1.88 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
clc;
clear;
A= [ 0 1 0 0 0 0
-4.7059 -.0882 0 0 1.3588 0
0 0 0 1 0 0
0 0 0 -5 1.617 4.5
0 0 0 0 -.9091 0
0 0 0 0 0 -1
];
B=[0 0
0 0
0 0
0 0
1 0
0 .8
];
C=[1 0 0 0 0 0;
0 0 1 0 0 0;
];
D=zeros(2,2);
sys = ss(A,B,C,D);
tf(sys)
%Section 1:--------------------------
%s=tf('s');
syms s;
G= [(1.359/(s^3+0.9973*s^2+4.786*s+4.278)) 0;
(1.617/(s^3+5.909*s^2+4.546*s)) (3.6/(s^3+6*s^2+5*s));
];
%Section 2:---------------------------
pzmap(sys);
%Section 3:---------------------------
J = jordan(A);
disp('Jordan Matrix of A is:');
disp(J);
%Section 4:---------------------------
F=(s*eye(6,6)-A);
phi=ilaplace(F);
syms t;
f= expm(A*t);
disp('Transition Matrix is:');
disp(f);
%Section 6:---------------------------
Co=ctrb(A,B); %Controllability Matrix
rCo=rank(Co); %Rank of Controllability Matrix
Ob=obsv(A,C); %Observability Matrix
rOb=rank(Ob); %Rank of Observability Matrix
disp('Controllability Matrix:');
disp(Co);
disp('Rank of Controllability Matrix:');
disp(rCo);
disp('It is Controlable since it is Full-rank.')
disp('Observability Matrix:');
disp(Co);
disp('Rank of Observability Matrix:');
disp(rCo);
disp('It is Observable since it is Full-rank.')
%Section 7:-----------------------------
if isstable(G(1,1))
disp('G(1,1) is Stable')
else
disp('G(1,1) is not Stable')
end
if isstable(G(1,2))
disp('G(1,2) is Stable')
else
disp('G(1,2) is not Stable')
end
if isstable(G(2,1))
disp('G(2,1) is Stable')
else
disp('G(2,1) is not Stable')
end
if isstable(G(2,2))
disp('G(2,2) is Stable')
else
disp('G(2,2) is not Stable')
end
%Section 8:------------------------------------------
e=eig(A);
disp('Eigenvalues of A are:');
disp(e);
%Section emtiazi:-----------------------------------
p=[-8; % desired poles
-8;
-7;
-5;
-11;
-9;];
K=place(A,B,p); % For feedback in the simulink simulation