-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObservabilityCheck.m
65 lines (60 loc) · 1.99 KB
/
ObservabilityCheck.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
%------------- Linearised System Matrices ---------------%
ALI = [ 0, 1, 0, 0, 0, 0;
0, 0, -49/50, 0, -49/50, 0;
0, 0, 0, 1, 0, 0;
0, 0, -539/1000, 0, -49/1000, 0;
0, 0, 0, 0, 0, 1;
0, 0, -49/500, 0, -539/500, 0];
BLI = [0;
1/1000;
0;
1/20000;
0;
1/10000];
%------------- Observability for x(t) ---------------%
CX = [1 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;
];
%For the system to be controllable, the rank must be equal to matrix A rank
if length(ALI) == rank(obsv(ALI, CX))
disp('The system is Observable for x(t)');
else
disp("System is not Observable for x(t)");
end
%------------- Observability for theta1(t), theta2(t) ---------------%
CT12 = [0 0 0 0 0 0;
0 0 1 0 0 0;
0 0 0 0 1 0;
];
%For the system to be controllable, the rank must be equal to matrix A rank
if length(ALI) == rank(obsv(ALI, CT12))
disp('The system is Observable for theta1(t) and theta2(t)');
else
disp("System is not Observable for theta1(t) and theta2(t)");
end
%------------- Observability for x(t), theta2(t) ---------------%
CXT1 = [1 0 0 0 0 0;
0 0 0 0 0 0;
0 0 0 0 1 0;
];
%For the system to be controllable, the rank must be equal to matrix A rank
if length(ALI) == rank(obsv(ALI, CXT1))
disp('The system is Observable for x(t) and theta1(t)');
else
disp("System is not Observable for x(t) and theta1(t)");
end
%------------- Observability for x(t), theta1(t), theta2(t) ------------%
CXT12 = [1 0 0 0 0 0;
0 0 1 0 0 0;
0 0 0 0 1 0;
];
%For the system to be controllable, the rank must be equal to matrix A rank
if length(ALI) == rank(obsv(ALI, CXT12))
disp('The system is Observable for x(t), theta1(t) and theta2(t)');
else
disp("System is not Observable for x(t), theta1(t) and theta2(t)");
end
disp(' ');
%------------- Luenberger observer ------------%
% [LO, PO, EO] = lqe(ALI,BLI,CX,QLI',R);