%  Example 5.7.  Determine stability robustness using the small gain theorem.
clear
%  Define the plant.
A=[0  1   0   0
   0  0   0 -1.6
   0  0   0   1
   0 1.8  0   0];
B=[ 0   0
   11   0
    0   0
    0  12];
%  Generate a state feedback controller.
%    Define the closed loop poles.
p=[-5+10*j -5-10*j -6+12*j -6-12*j];
%    Compute the feedback gain.
K=place(A,B,p)
%  Generate the closed loop system model for dermining stability robustness.
sys=pck(A-B*K,B,-0.5*K,zeros(2));
%  Compute the infinity norm.
hinfnorm(sys)
%  Generate the principle gains.
w=logspace(-1,2);
fr = frsp(sys,w);
pg=vsvd(fr);
%  Plot the principle gains.
set(0,'DefaultAxesFontName','times')
set(0,'DefaultAxesFontSize',16)
set(0,'DefaultTextFontName','times')
figure(1)
clf
vplot('liv,lm',pg)
xlabel('Frequency (rad/sec)')
ylabel('Magnitude')
grid