%% Disk Margins Based on Sensitivity and Complementary Sensitivity
% diskmargin bases its computation on a shifted sensitivity function S+\left(E-1\right)I/2, where S={\left(I+L\right)}^{-1} is the sensitivity function and E is the eccentricity parameter. By default, E = 0, which corresponds to the balanced sensitivity function S-I/2=\left(S-T\right)/2, where  T=I-S is the complementary sensitivity function. Setting E = 1 computes disk margins based on S, while E = -1 computes the disk margins based on T. You can try different values of E and combine the results to obtain less conservative stability margins than you get from the balanced sensitivity function alone.
% Compute margins based on the complementary sensitivity, balanced sensitivity, and sensitivity functions for the system with open-loop transfer function given by
% L=\frac{25}{s^3 +10s^2 +10s+10}\ldotp

L = tf(25,[1 10 10 10]);
DMt = diskmargin(L,-1);
DMb = diskmargin(L); 
DMs = diskmargin(L,1);

%
% Compare the resulting gain margins.

DMt.GainMargin
DMb.GainMargin
DMs.GainMargin

% The different E values give different ranges for the estimated gain margins. Each of these is a different estimate for the true gain margins, and each guarantees stability for gain variations within its range. Therefore, the closed-loop system is guaranteed to remain stable for all variations in the union of all three ranges, or variations in the open-loop gain of a factor between about 0.51 and about 1.67.
%
% For some systems, larger positive or negative E values can yield an even larger range of guaranteed stability.

DMnegE = diskmargin(L,-100);
DMposE = diskmargin(L,100); 
DMnegE.GainMargin
DMposE.GainMargin

% These values extend the range such that stability is guaranteed for gain variations of a factor between about 0.08 and about 1.91.
% For more information about the variation of gain margin estimates with E, see docid:robust_ug.mw_a81dfae6-e5fb-436c-b6c7-b86e29ca8c2d.
%
% Copyright 2018 The MathWorks, Inc.