%% Balanced Disk-Based Gain Margin from Gain and Phase Margins
% Determine the disk-based gain margin that delivers symmetric gain variation of \pm5 dB and phase variation of \pm30 degrees.

GM = db2mag(5);
PM = 30;
DGM = getDGM(GM,PM,'balanced')

% The 'balanced' constraint models a disk of uncertainty that is symmetric around the nominal value. The function returns a symmetric disk-based gain margin DGM = [gmin,gmax], with gmin=1/gmax.

diskmarginplot(DGM)

% In this case, DPM slightly exceeds the target phase variation and DGM is equal to the target gain variation.
% Copyright 2019 The MathWorks, Inc.