% Problem 5.21

A=[-16.11 - 0.39 27.2    0        0;
     0.01 -16.99  0      0       12.47;
    15.11   0   -53.6  -16.57    71.78;
   -53.36   0     0   -107.2    232.11;
     2.27  60.1   0      2.273 -102.99]

B=[11.12 -2.61 -21.91 -53.5 69.1;
   -12.6  3.36   0      0    0]'

C=[0 0 0 0 1;
   0 1 1 0 0]

% 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
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

