%% Change Amount of Uncertainty Modeled by a umargin Block
% Consider a umargin block that captures a gain variation of a factor of 1.5 in either direction, and a phase variation of ±20°.

DGM = getDGM(1.5,20,'tight');
F = umargin('F',DGM)

% When you create the umargin object, you provide the target disk-based gain variation DGM, which defines a disk of uncertainty. This value becomes the property F.GainChange, and umargin sets other properties based on this value. For instance, F.PhaseChange is automatically set to the phase range corresponding to the uncertainty disk defined by DGM. The properties F.DiskMargin and F.Eccentricity are automatically set to the corresponding α and E values of the disk (see Algorithms). Examine the values of these properties.

get(F)

%
% You can change the amount of modeled gain and phase uncertainty using the uscale commmand, which scales the normalized uncertainty of the block by a factor you specify. Scale the uncertainty of F by one half, and examine the properties of the scaled uncertain block.

Fscaled = uscale(F,0.5)
get(Fscaled)

% For umargin blocks, uscale multiplies the DiskMargin property by the scaling factor, scaling the size of the disk and adjusting the ranges of gain and phase variations accordingly.
% If you manually change any of the properties that relate to the size of the modeled uncertainty, the block automatically updates the values of all of them. For instance, set F.GainChange to a new value that defines a different uncertainty disk. The properties of F are automatically updated to reflect the new corresponding phase range (F.PhaseChange) and the values of α and E (F.DiskMargin and F.Eccentricity) that describe the new disk.

F.GainChange = [0.8,1.5];
get(F)

% Here, F.PhaseChange, F.DiskMargin, and F.Eccentricity are all updated to describe the disk defined by the new value of F.GainChange. The new value of F.Eccentricity is non-zero, because the new gain range is not symmetric (gmin ≠ 1/gmax).
%
% Copyright 2019 The MathWorks, Inc.