control.stability_margins

control.stability_margins(sysdata, returnall=False, epsw=0.0, method='best')[source]

Stability margins and associated crossover frequencies.

Parameters
sysdataLTI system or 3-tuple of array_like

Linear SISO system representing the loop transfer function. Alternatively, a three tuple of the form (mag, phase, omega) providing the frequency response can be passed.

returnallbool, optional

If true, return all margins found. If False (default), return only the minimum stability margins. For frequency data or FRD systems, only margins in the given frequency region can be found and returned.

epswfloat, optional

Frequencies below this value (default 0.0) are considered static gain, and not returned as margin.

methodstring, optional

Method to use (default is ‘best’):

  • ‘poly’: use polynomial method if passed a LTI system.

  • ‘frd’: calculate crossover frequencies using numerical interpolation of a FrequencyResponseData representation of the system if passed a LTI system.

  • ‘best’: use the ‘poly’ method if possible, reverting to ‘frd’ if it is detected that numerical inaccuracy is likely to arise in the ‘poly’ method for for discrete-time systems.

Returns
gmfloat or array_like

Gain margin.

pmfloat or array_like

Phase margin.

smfloat or array_like

Stability margin, the minimum distance from the Nyquist plot to -1.

wpcfloat or array_like

Phase crossover frequency (where phase crosses -180 degrees), which is associated with the gain margin.

wgcfloat or array_like

Gain crossover frequency (where gain crosses 1), which is associated with the phase margin.

wmsfloat or array_like

Stability margin frequency (where Nyquist plot is closest to -1).

Notes

The gain margin is determined by the gain of the loop transfer function at the phase crossover frequency(s), the phase margin is determined by the phase of the loop transfer function at the gain crossover frequency(s), and the stability margin is determined by the frequency of maximum sensitivity (given by the magnitude of 1/(1+L)).