control.stability_margins

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

Calculate stability margins and associated crossover frequencies.

Parameters
  • sysdata (LTI system or (mag, phase, omega) sequence) –

    sysLTI system

    Linear SISO system representing the loop transfer function

    mag, phase, omegasequence of array_like

    Arrays of magnitudes (absolute values, not dB), phases (degrees), and corresponding frequencies. Crossover frequencies returned are in the same units as those in omega (e.g., rad/sec or Hz).

  • returnall (bool, 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.

  • epsw (float, optional) – Frequencies below this value (default 0.0) are considered static gain, and not returned as margin.

  • method (string, 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 likey to arise in the ‘poly’ method for for discrete-time systems.

Returns

  • gm (float or array_like) – Gain margin

  • pm (float or array_loke) – Phase margin

  • sm (float or array_like) – Stability margin, the minimum distance from the Nyquist plot to -1

  • wpc (float or array_like) – Phase crossover frequency (where phase crosses -180 degrees)

  • wgc (float or array_like) – Gain crossover frequency (where gain crosses 1)

  • wms (float or array_like) – Stability margin frequency (where Nyquist plot is closest to -1)

  • Note that 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)).