%% Mixed-Sensitivity Synthesis
% Design a mixed-sensitivity controller for the following plant, augmented by the following loop-shaping filters (see mixsyn).
%  G(s) = {{s - 1} \over {s + 1}},{\rm{ }}{W_{\rm{1}}}{\rm{ = }}{{0.1(s +
% 100)} \over {100s + 1}},{\rm{ }}{W_2} = 0.1,{\rm{ no}}\;{W_3}.
%
% Define the plant, weighting filters, and augmented plant.

s = zpk('s');
G = (s-1)/(s+1);
W1 = 0.1*(s+100)/(100*s+1); 
W2 = 0.1; 
W3 = [];
P = augw(G,W1,W2,W3);

%
% Synthesize the controller.

[K,CL,gamma] = hinfsyn(P,1,1);
gamma

%
% For this system, gamma is about 0.18, or about –15 dB.
% Examine the singular values of the closed-loop result.

sigma(CL,ss(gamma))

%
% Compute a new controller for the same system with no W_1.

W1 = [];
P = augw(G,W1,W2,W3);
[K,CL,gamma] = hinfsyn(P,1,1);

% In this case, the resulting controller K is zero, and the closed-loop transfer function CL = K*(1+G*K) is also zero.
% Copyright 2012 The MathWorks, Inc.