@@ -222,16 +222,15 @@ def fun(wdt):
222222# frd data. Correct to return smallest phase
223223# margin, smallest gain margin and their frequencies
224224#
225- # RvP, Jun 10, 2017, modified the inclusion of roots found for phase
226- # crossing to include all >= 0, made subsequent
227- # calc insensitive to div by 0. Also changed the
228- # selection of which crossings to return on basis
229- # of "A note on the Gain and Phase Margin Concepts"
230- # Journal of Control and Systems Engineering,
231- # Yazdan Bavafi-Toosi, Dec 2015, vol 3 issue 1, pp
232- # 51-59, closer to Matlab behavior, but not
233- # completely identical in edge cases, which don't
234- # cross but touch gain=1.
225+ # RvP, Jun 10, 2017, modified the inclusion of roots found for phase crossing
226+ # to include all >= 0, made subsequent calc insensitive to
227+ # div by 0. Also changed the selection of which crossings
228+ # to return on basis of "A note on the Gain and Phase
229+ # Margin Concepts" Journal of Control and Systems
230+ # Engineering, Yazdan Bavafi-Toosi, Dec 2015, vol 3 issue
231+ # 1, pp 51-59, closer to Matlab behavior, but not
232+ # completely identical in edge cases, which don't cross but
233+ # touch gain=1.
235234#
236235# BG, Nov 9, 2020, removed duplicate implementations of the same code
237236# for crossover frequencies and enhanced to handle discrete
@@ -260,17 +259,17 @@ def stability_margins(sysdata, returnall=False, epsw=0.0):
260259
261260 Returns
262261 -------
263- gm: float or array_like
262+ gm : float or array_like
264263 Gain margin
265- pm: float or array_loke
264+ pm : float or array_loke
266265 Phase margin
267- sm: float or array_like
266+ sm : float or array_like
268267 Stability margin, the minimum distance from the Nyquist plot to -1
269- wpc: float or array_like
268+ wpc : float or array_like
270269 Phase crossover frequency (where phase crosses -180 degrees)
271- wgc: float or array_like
270+ wgc : float or array_like
272271 Gain crossover frequency (where gain crosses 1)
273- wms: float or array_like
272+ wms : float or array_like
274273 Stability margin frequency (where Nyquist plot is closest to -1)
275274
276275 Note that the gain margin is determined by the gain of the loop
@@ -480,17 +479,16 @@ def margin(*args):
480479 Gain margin
481480 pm : float
482481 Phase margin (in degrees)
483- wg : float
484- Frequency for gain margin (at phase crossover, phase = -180 degrees)
485- wp : float
486- Frequency for phase margin (at gain crossover, gain = 1)
482+ wpc : float or array_like
483+ Phase crossover frequency (where phase crosses -180 degrees)
484+ wgc : float or array_like
485+ Gain crossover frequency (where gain crosses 1)
487486
488487 Margins are calculated for a SISO open-loop system.
489488
490- If there is more than one gain crossover, the one at the smallest
491- margin (deviation from gain = 1), in absolute sense, is
492- returned. Likewise the smallest phase margin (in absolute sense)
493- is returned.
489+ If there is more than one gain crossover, the one at the smallest margin
490+ (deviation from gain = 1), in absolute sense, is returned. Likewise the
491+ smallest phase margin (in absolute sense) is returned.
494492
495493 Examples
496494 --------
0 commit comments