You are on page 1of 3

Experiment number 5:- Controllability And Observability

Que. Enter the matrix A, B, C, D and check out its controllability and observability.

ANSWER: - EDITOR WINDOW

% Program for Controllability & Observability
clc
clear all;
close all;

A=input('Enter matrix A ')
B=input('Enter matrix B ')
C=input('Enter matrix C ')
D=input('Enter matrix D ')
SOA=size(A);
n=SOA(1,1);

% Block code for Controllability

q=[];
for i=0:1:n-1
q=[q A^i*B];
end
q

R1=rank(q)

if(R1==n)
disp('System is state controllable')
else
disp('System is not state controllable')
end
%-----------------------------------------------

% Block code for Observability

q1=[];
for i=0:1:n-1
q1=[q1; C*A^i];
end
q1
R2=rank(q1)

if(R2==n)
disp('System is Observable')
else
disp('System is not Observable')
end
%------------------------------------------------


ANSWER: - COMMAND WINDOW
Enter matrix A [0 1 0; 0 0 1; -2 -5 -3]
A =
0 1 0
0 0 1
-2 -5 -3
Enter matrix B [0; 0; 1]
B =
0
0
1
Enter matrix C [1 2 4]
C =
1 2 4

Enter matrix D [0 0 0]
D =
0 0 0

q =
0 0 1
0 1 -3
1 -3 4

R1 =
3
System is state controllable
q1 =
1 2 4
-8 -19 -10
20 42 11

R2 =
3
System is Observable

You might also like