% simple mfile to find the obsv of 3 systems
clear, clc
%------------------------------------------------------------------------
disp('First system')
disp('My two matrices are')
A1=diag([-2,1]), C1=[1 1],
disp('The obsv matrix is [C1; C1*A1]'), Mo=[C1; C1*A1]
% Matlab can do it at once
Mo_matlab=obsv(A1,C1)
% test if the system is obsv
rank_Mo=rank(Mo), disp('order of system 2, rank 2, hence obsv system')
det_M=det(Mo), disp('det 3, hence obsv system')
%------------------------------------------------------------------------
disp('...................................................')
disp(' ')
disp('Second system')
disp('My two matrices are')
A2=[-2 1; 0 1], C2=[1 0],
disp('The obsv matrix is [C2; C2*A2]'), Mo=[C2; C2*A2]
% Matlab can do it at once
Mo_matlab=obsv(A2,C2)
% test if the system is obsv
rank_Mo=rank(Mo), disp('order of system 2, rank 2, hence obsv system')
det_M=det(Mo), disp('det 3, hence obsv system')
%------------------------------------------------------------------------
disp('...................................................')
disp(' ')
disp('Third system')
disp('My two matrices are')
A3=[-2 0; 0 1], C3=[1 0],
disp('The obsv matrix is [C3; C3*A3]'), Mo=[C3; C3*A3]
% Matlab can do it at once
Mo_matlab=obsv(A3,C3)
% test if the system is obsv
rank_Mo=rank(Mo), disp('order of system 2, rank 1, hence unobsv system')
det_M=det(Mo), disp('det 0, hence unobsv system')
%------------------------------------------------------------------------
