%  Example 10.6 (continuation). Generate Robust Performance for the 
%  closed loop system.
%  Generate the nominal closed loop system.
systemnames = 'P K';
inputvar = '[wZa; wMa; wMtd; wi; wfb; etac; e_gyro]';
outputvar = '[P(1:8)]';
input_to_P = '[wZa; wMa; wMtd; wi; wfb; etac; e_gyro; K]';
input_to_K = '[P(9:10)]';
sysoutname='M';
cleanupsysic='yes';
sysic
%  Define a frequency vector.
omega=logspace(-1,4);
%  Generate the frequency response.
frM=frsp(M,omega);
%  Define the block structure for evaluating robust performance.
blk=ones(6,2);
blk(6,:)=[2 3];
%  Generate the structured singular value.
MUofM=mu(frM,blk);
%
%  Generate Robust Stability for the closed loop system.
%
%  Select Mydwd.
Mydwd=sel(M,1:5,1:5);
%  Generate the frequency response.
frMydwd=frsp(Mydwd,omega);
%  Define the block structure for evaluating robust stability.
blk=ones(5,2);
%  Generate the structured singular value.
MUofMydwd=mu(frMydwd,blk);
%
%  Generate Nominal Performance for the closed loop system.
%
%  Select Myd. 
Myd=sel(M,6:8,6:7);
%  Generate the frequency response.
frMyd=frsp(Myd,omega);
%  Generate the principle gains.
SIGofMyd=vsvd(frMyd);
%  Plot Robust performance, robust stability, and nominal performance results.
set(0,'DefaultAxesFontName','times')
set(0,'DefaultAxesFontSize',16)
set(0,'DefaultTextFontName','times')
figure(3)
clf
vplot('liv,m',sel(MUofM,1,1),'r-',sel(MUofMydwd,1,1),'r--',sel(SIGofMyd,1,1),'r-.')
xlabel('Frequency (rad/sec)')
ylabel('SSV')
grid
legend('Robust performance','Robust stability','Nominal performance')
