0% found this document useful (0 votes)
35 views8 pages

Controllability and Observability

MATLAB Code
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)
35 views8 pages

Controllability and Observability

MATLAB Code
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/ 8

Problem 1 :

MATLAB Code:

clc;
% close all
clear all;
A = [1 2; -4 -3];
B= [1; 2];
C=[1 1];
CR = ctrb(A, B);
Observe = obsv(A, C);
size_A = size(A);
Rank_system = rank(CR);
if Rank_system == size_A(1)
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
Rank_obs = rank(Observe);
if Rank_obs == size_A(1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

1
Problem 2 :

MATLAB Code:

clc;
% close all
clear all;
A = [0, 1, 0; 0, 0, 1; -6, -11, -6];
B = [0; 0; 1];
C = [20, 9, 1];
CR = ctrb(A, B);
Observe = obsv(A, C);
size_A = size(A);
Rank_system = rank(CR);
if Rank_system == size_A(1)
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
Rank_obs = rank(Observe);
if Rank_obs == size_A(1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

2
Problem 3 :

MATLAB Code:

clc;
% close all
clear all;
A = [2, 0, 0; 0, 2, 0; 0, 3, 1];
B = [0;0;0];
C = [1, 1, 1; 1, 2, 3];
CR = ctrb(A, B);
Observe = obsv(A, C);
size_A = size(A);
Rank_system = rank(CR);
if Rank_system == size_A(1)
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
Rank_obs = rank(Observe);
if Rank_obs == size_A(1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

3
Problem 4 :

MATLAB Code:

clc;
% close all
clear all
A = [1 100; 0 4];
B = [1; 0];
C = [1 0];
D = [0];
CR = ctrb(A, B);
Observe = obsv(A, C);
size_A = size(A);
Rank_system = rank(CR);
if Rank_system == size_A(1)
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
Rank_obs = rank(Observe);
if Rank_obs == size_A(1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

4
Problem 5 :

MATLAB Code:

clc;
% close all
clear all;
A= [-12.01 -5.655;4 0];
B= [2;0];
C=[0 2.85];
CR = ctrb(A, B);
Observe = obsv(A, C);
size_A = size(A);
Rank_system = rank(CR);
if Rank_system == size_A(1)
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
Rank_obs = rank(Observe);
if Rank_obs == size_A(1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

5
Problem 6 :

MATLAB Code:

clc;
clear all;
clf
J = 0.01;
b = 0.001;
k = 0.01;
R = 1;
L = 0.5;
s= tf('s');
TF=k/((J *s+ b )* (L* s +R )+k^2);
sys=ss(TF)
step(sys)
A= [-2.1 -0.44;0.5 0];
B= [2;0];
C=[0 2];
co= ctrb(A,B);
O = obsv(A,C);
rank_co= rank(co);
n = size(A, 1);
if rank_co == n
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
rank_O = rank(O);
if rank_O == size(A,1)
disp('The system is Observable.');
else
disp('The system is not Observable.');
end

Result:

6
Problem 7 :

MATLAB Code:

clc;
clear all;
clf
m=0.01;
D=0.5;
K=1;
s= tf('s');
TF=1/(m*s^2+D*s+K);
sys=ss(TF)
step(sys)
A= [-50 -12.5;8 0];
B= [4;0];
C=[0 3.125];
co= ctrb(A,B);
O = obsv(A,C);
rank_co= rank(co);
n = size(A, 1);
if rank_co == n
disp('The system is controllable.');
else
disp('The system is not controllable.');
end
rank_O = rank(O);
if rank_O == size(A,1)
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

7
Problem 8 :

MATLAB Code:

clc;
clear all;
clf;
C = 0.01;
R1 = 0.1;
R2 = 3;
L = 20;
s = tf('s');
TF = s*L / (s^2*C*L*(R1+R2) + s*(R1 + R2*C + L) + R1);
sys = ss(TF);
step(sys);
A = [-32.47 -0.3226; 0.5 0];
B = [8; 0];
C = [4.032 0];
D = 0;
co = ctrb(A, B);
rank_co = rank(co);
n = size(A, 1);
if rank_co == n
disp('The system is Controllable.');
else
disp('The system is not Controllable.');
end
O = obsv(A, C);
rank_O = rank(O);
if rank_O == n
disp('The system is observable.');
else
disp('The system is not observable.');
end

Result:

You might also like