%% Disk-Based Gain and Phase Ranges for Multiple Target Gain and Phase Variations
% Determine the balanced disk-based gain margin ranges that delivers gain variations of ±4 dB, ±6 dB, and ±12 dB and phase variation of ±30°. You can get all the disk-based gain ranges at once by stacking the desired target ranges into a column vector.

GM = db2mag([4;6;12]);
PM = 30;
DGM = getDGM(GM,PM,'balanced')
diskmarginplot(DGM)

% Each row in the matrix DGM gives the disk-based gain variation for the corresponding entry in GM. For instance, the smallest balanced (symmetric) disk that captures gain variation of ±4 dB and phase variation of ±30° is specified by DGM(1,:) = [0.58 1.73].
% This disk represents somewhat more than the target ±4 dB, in order to capture the full target gain variation of ±30°. For the targets ±6 dB and ±12 dB, the disk meets the target gain variation exactly, but the corresponding disks describe larger phase variations.
%
% Copyright 2019 The MathWorks, Inc.