123mylist.com

Controllability & Observability test on a control system using Matlab

Controllability & Observability test on a control system using Matlab.

In state space analysis in Control system, sometimes we come across controllability and observability test on a control system. In this post I want to share with you an elementary Matlab program demonstrating the results of whether the system is observable and controllable or not using the well known Kalman’s Test algorithm.

In this program, I have used the state space analysis approach using a 3x3 matrix for A, 3x1 matrix for B and 1x3 matrix for C as per the equation:

X= Ax + Bu
Y= Cx + Du


In this program, you can change the value of A, B and C as per your system parameters. You can also modify this program if you want to use 2x2 or 4x4 matrix as per your problem requirement.

The program is given below:


%{
Kalmans test for controllability and observability
 x* = Ax + Bu
 y  = Cx + Du
controllability condition Q = [B AB A2B]
Observability condition T=[CT ATCT (AT)2CT]
%}
clc
clear all
A=[0 0 1; -2 -3 0; 0 2 -3]
B=[0; 2; 0]
C=[1 0 0]
D=0
Q=horzcat(B,A*B,(A^2)*B)
t1=transpose(C);
t2=transpose(A);
T=horzcat(t1,t2*t1,((t2)^2)*t1)
if rank(Q)==3
    fprintf('Controllable\n')
else
    fprintf('Not controllable\n')
end
if rank(T)==3
    fprintf('Observable\n')
else
    fprintf('Not Observable\n')
end


If you have any doubt, query or suggestions then you can post your comments below.

Content is copyrighted © www.123mylist.com