% Problem 5.20
disp('System model:')
A=[0       0   1 0;
   0       0   0 1;
  12.49 -12.54 0 0;
  -14.49 29.36 0 0]
B=[0; 0; -2.98; 5.98]
C=[1 0 1 0]
D=0

% Controllability matrix
disp(' ')
disp('Controllability matrix:')
Co=ctrb(A,B)
r_Co=rank(Co)
if r_Co < size(A,1)
  disp('System is not controllable!')
else
  disp('System is controllable!')
end

% Observability matrix
disp(' ')
disp('Observability matrix:')
Ob=obsv(A,C)
r_Ob=rank(Ob)
if r_Ob < size(A,1)
  disp('System is not observable!')
else
  disp('System is observable!')
end

