%% Plot Worst-Case Gain of Uncertain System
% Plot the worst-case gain of the following system:
% sys = \frac{{{s^2} + 3s}}{{{s^2} + 2s + a}}.
% The uncertain parameter a = 2 \pm 1.

a = ureal('a',2);
usys = tf([1 3 0],[1 2 a]);
wcsigmaplot(usys)

% The Worst perturbation curve identifies the single response within the uncertainty that yields the highest gain at any frequency. This perturbation corresponds to the wcu output of wcgain.
% The Worst-case gain curves show the lower and upper bounds on the worst-case gain at each frequency. For any perturbation within the specified uncertainty range, the principal gains (singular values) of the perturbed system lie below the Worst-case gain (upper bound) curve. In other words, this curve is the envelope produced by finding the highest gain within the uncertainty at each frequency. For this system, the lower and upper bounds are close enough to appear identical on the plot. (See wcgain for more information about these bounds.)
%
% Focus the plot on the region between 0.1 and 10 rad/s.

w = {0.1 10};
wcsigmaplot(usys,w)

%
% Examine the effect on the worst-case response of increasing the uncertainty range. To do this without changing the uncertainty specified in usys, use the ULevel option of wcOptions. This option scales the normalized uncertainty by the factor you specify. For example, examine the worst-case response a 50% greater uncertainty range.

opts = wcOptions('ULevel',1.5);
wcsigmaplot(usys,w,opts)

% The plot shows that increasing the uncertainty range substantially increases the worst-case gain at low frequencies.
% Copyright 2012 The MathWorks, Inc.