%% Plot Gain and Phase Margins of Transfer Function
% For this example, create a continuous transfer function.

sys = tf(1,[1 2 1 0])

%
% Display the gain and phase margins graphically.

margin(sys)

% The gain margin (6.02 dB) and phase margin (21.4 deg), displayed in the title, are marked with solid vertical lines. The dashed vertical lines indicate the locations of Wcg, the frequency where the gain margin is measured, and Wcp, the frequency where the phase margin is measured.
% Copyright 2012 The MathWorks, Inc.