control.margin

control.margin(sys)     margin(mag, phase, omega)[source]

Gain and phase margins and associated crossover frequencies.

Can be called as margin(sys) where sys is a SISO LTI system or margin(mag, phase, omega).

Parameters
sysStateSpace or TransferFunction

Linear SISO system representing the loop transfer function.

mag, phase, omegasequence of array_like

Input magnitude, phase (in deg.), and frequencies (rad/sec) from bode frequency response data.

Returns
gmfloat

Gain margin.

pmfloat

Phase margin (in degrees).

wcgfloat or array_like

Crossover frequency associated with gain margin (phase crossover frequency), where phase crosses below -180 degrees.

wcpfloat or array_like

Crossover frequency associated with phase margin (gain crossover frequency), where gain crosses below 1.

Margins are calculated for a SISO open-loop system.
If there is more than one gain crossover, the one at the smallest margin
(deviation from gain = 1), in absolute sense, is returned. Likewise the
smallest phase margin (in absolute sense) is returned.

Examples

>>> G = ct.tf(1, [1, 2, 1, 0])
>>> gm, pm, wcg, wcp = ct.margin(G)