8000 Merge pull request #198 from murrayrm/fix_margins_doc · uLipe/python-control@5158a39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5158a39

Browse files
authored
Merge pull request python-control#198 from murrayrm/fix_margins_doc
Fix margin() documentation to address issue python-control#195
2 parents 077a8bc + 1593391 commit 5158a39

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

control/margins.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def stability_margins(sysdata, returnall=False, epsw=0.0):
108108
Linear SISO system
109109
mag, phase, omega : sequence of array_like
110110
Arrays of magnitudes (absolute values, not dB), phases (degrees),
111-
and corresponding frequencies. Crossover frequencies returned are
111+
and corresponding frequencies. Crossover frequencies returned are
112112
in the same units as those in `omega` (e.g., rad/sec or Hz).
113113
returnall: bool, optional
114-
If true, return all margins found. If false (default), return only the
115-
minimum stability margins. For frequency data or FRD systems, only one
116-
margin is found and returned.
114+
If true, return all margins found. If False (default), return only the
115+
minimum stability margins. For frequency data or FRD systems, only
116+
margins in the given frequency region can be found and returned.
117117
epsw: float, optional
118118
Frequencies below this value (default 0.0) are considered static gain,
119119
and not returned as margin.
@@ -127,11 +127,11 @@ def stability_margins(sysdata, returnall=False, epsw=0.0):
127127
sm: float or array_like
128128
Stability margin, the minimum distance from the Nyquist plot to -1
129129
wg: float or array_like
130-
Gain margin crossover frequency (where phase crosses -180 degrees)
130+
Frequency for gain margin (at phase crossover, phase = -180 degrees)
131131
wp: float or array_like
132-
Phase margin crossover frequency (where gain crosses 0 dB)
132+
Frequency for phase margin (at gain crossover, gain = 0 dB)
133133
ws: float or array_like
134-
Stability margin frequency (where Nyquist plot is closest to -1)
134+
Frequency for stability margin (complex gain closest to -1)
135135
"""
136136

137137
try:
@@ -340,18 +340,22 @@ def margin(*args):
340340
Gain margin
341341
pm : float
342342
Phase margin (in degrees)
343-
Wcg : float
344-
Gain crossover frequency (corresponding to phase margin)
345-
Wcp : float
346-
Phase crossover frequency (corresponding to gain margin) (in rad/sec)
343+
wg: float
344+
Frequency for gain margin (at phase crossover, phase = -180 degrees)
345+
wp: float
346+
Frequency for phase margin (at gain crossover, gain = 0 dB)
347347
348-
Margins are of SISO open-loop. If more than one crossover frequency is
349-
detected, returns the lowest corresponding margin.
348+
Margins are calculated for a SISO open-loop system.
349+
350+
If there is more than one gain crossover, the one at the smallest
351+
margin (deviation from gain=0dB), in absolute sense, is
352+
returned. Likewise the smallest phase margin (in absolute sense)
353+
is returned.
350354
351355
Examples
352356
--------
353357
>>> sys = tf(1, [1, 2, 1, 0])
354-
>>> gm, pm, Wcg, Wcp = margin(sys)
358+
>>> gm, pm, wg, wp = margin(sys)
355359
356360
"""
357361
if len(args) == 1:

0 commit comments

Comments
 (0)
0