Gain margin and phase margin
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
The Nyquist criterion says whether a feedback loop is stable; the margins say how far it is from the edge. Cut the loop K/(s+1)³ with K = 4, send a sine round once, and read two numbers off the open-loop Bode plot: how much more gain it could take (6.02 dB) and how much more lag (27.1°). Then spend the whole gain margin and watch the closed loop oscillate.
How far from the edge?
This is the loop from the Nyquist lesson: a gain K = 4, the plant G(s) = 1/(s+1)³ and negative feedback. Nyquist said it is stable. Now we ask how stable: how far is it from the edge?
open loop L(s) = K·G(s) = 4/(s+1)³ closed loop y/r = L/(1 + L) Nyquist: no encirclement of −1, so the closed loop is stable. A yes/no answer is not enough: a part wears, a gain drifts. How much change can the loop take before it goes unstable?
اقرأ الدرس خطوة بخطوة
How far from the edge?
This is the loop from the Nyquist lesson: a gain K = 4, the plant G(s) = 1/(s+1)³ and negative feedback. Nyquist said it is stable. Now we ask how stable: how far is it from the edge?
open loop L(s) = K·G(s) = 4/(s+1)³ closed loop y/r = L/(1 + L) Nyquist: no encirclement of −1, so the closed loop is stable. A yes/no answer is not enough: a part wears, a gain drifts. How much change can the loop take before it goes unstable?Cut the loop, send a sine
Cut the loop at the junction and feed in a sine. It goes once through K and G and comes back changed: scaled by |L(jω)| and shifted by ∠L(jω). Sweeping ω draws the open-loop Bode and Nyquist plots.
L(jω) = 4 / (1 + jω)³ |L| = 4 / (1 + ω²)^1.5 ∠L = −3·atan(ω) ω (rad/s) |L| ∠L 0.2 3.77 −33.9° 1.0 1.41 −135.0° 5.0 0.030 −236.1° Small ω: comes back big, little shift. Large ω: comes back tiny, shifted a lot.The edge is L = −1
Danger: a sine that comes back the same size and turned upside down, |L| = 1 and ∠L = −180°. The junction's minus sign flips it upright again, so it feeds itself for ever. On the plots: 0 dB, −180°, and the point −1.
Join the loop again. The returning sine passes the minus sign at the junction: −1 × (sine shifted −180°) = the sine itself If it also came back the same size (|L| = 1), it would keep itself going with no input at all: an oscillation. edge: L(jω) = −1 |L| = 1 (0 dB) and ∠L = −180°Find where the phase hits −180°
Slide the test frequency up the phase plot until the sine comes back exactly upside down. −3·atan ω = −180° gives ω = √3 = 1.73 rad/s, the phase crossover frequency. It does not depend on K.
∠L = −3·atan(ω) = −180° atan(ω) = 60° ω180 = √3 = 1.73 rad/s (phase crossover) K only scales the size of L, never its angle, so ω180 stays put whatever K is.Gain margin: how much more gain
At 1.73 rad/s the sine comes back upside down but only 0.50 as big (−6.02 dB), so it dies out. K could grow 2.0 times, 6.02 dB, before it came back full size. That headroom is the gain margin.
# gain margin: 1 / |L| where the phase is -180° import math K = 4.0 mag = lambda w: K / (1 + w * w) ** 1.5 phase = lambda w: -3 * math.degrees(math.atan(w)) lo, hi = 0.1, 10.0 # bisection on the phase for _ in range(60): mid = (lo + hi) / 2 lo, hi = (mid, hi) if phase(mid) > -180 else (lo, mid) gm = 1 / mag(lo) print(round(lo, 2), round(gm, 2), round(20 * math.log10(gm), 2)) # 1.73 2.0 6.02Find where |L| = 1
Now slide down the magnitude plot to where the sine comes back exactly the same size: |L| = 1, 0 dB. That happens at ω = 1.23 rad/s, the gain crossover frequency.
|L| = 4 / (1 + ω²)^1.5 = 1 1 + ω² = 4^(2/3) = 2.520 ωc = 1.23 rad/s (gain crossover) Below ωc the sine comes back bigger, above it smaller.Phase margin: how much more lag
At 1.23 rad/s the sine comes back full size but shifted only −152.9°, not −180°. 27.1° more lag, from a delay or a slow sensor, would put it on the edge. That headroom is the phase margin.
# phase margin: 180° + ∠L where |L| = 1 import math K = 4.0 mag = lambda w: K / (1 + w * w) ** 1.5 lo, hi = 0.1, 10.0 # bisection on the size for _ in range(60): mid = (lo + hi) / 2 lo, hi = (mid, hi) if mag(mid) > 1 else (lo, mid) pm = 180 - 3 * math.degrees(math.atan(lo)) print(round(lo, 2), round(pm, 1)) # 1.23 27.1Both margins on the Nyquist plot
The same two numbers are distances from −1. The curve crosses the negative real axis at −0.50: GM = 1/0.50 = 2.0. It crosses the unit circle 27.1° short of −1: that angle is the phase margin.
L(jω180) = −0.50 GM = 1 / 0.50 = 2.0 |L(jωc)| = 1, ∠L = −152.9° PM = 27.1° Grow K: the curve grows about the origin until −0.50 reaches −1 (×2.0). Add lag: the curve turns clockwise until the unit-circle crossing reaches −1.Spend the whole gain margin
Turn K up by the gain margin, 4 × 2.0 = 8. The magnitude curve rises 6.02 dB, both crossovers meet at 1.73 rad/s and both margins reach zero. Close the loop: the step response swings for ever.
K = 8: |L(jω180)| = 8/8 = 1, ∠L = −180° GM = 0 dB, PM = 0° closed-loop poles: ±j√3 and −3 step response: swings between 0.12 and 1.66 for ever, period 2π/√3 = 3.63 s. One more step up and it grows instead.More margin, calmer loop
K = 4 (GM 6.02 dB, PM 27.1°) overshoots 54%. K = 2 (GM 12.0 dB, PM 67.6°) overshoots 30%. A common target is GM above 6 dB and PM of 30° to 60°: our K = 4 is short on phase margin.
# GM PM overshoot # K = 8 0 dB 0° never settles # K = 4 6.02 dB 27.1° 54% # K = 2 12.0 dB 67.6° 30% # the same margins with python-control: import control L = control.tf([4], [1, 3, 3, 1]) gm, pm, wcg, wcp = control.margin(L) # gm ≈ 2.0, pm ≈ 27.1, wcg ≈ 1.73, wcp ≈ 1.23
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01Where on the open-loop Bode plot do you read the gain margin?
The gain margin is read at the phase crossover, here ω180 = 1.73 rad/s, where |L| = 0.50. It is 1/0.50 = 2.0, or 6.02 dB.
02For L(s) = 4/(s+1)³ the gain crossover is at 1.23 rad/s, where ∠L = −152.9°. What is the phase margin?
Phase margin = 180° + ∠L(jωc) = 180 − 152.9 = 27.1°: the extra lag the loop could take before the returning sine is exactly upside down at full size.
03A loop has a gain margin of 6 dB. By what factor can the gain K grow before the closed loop is on the edge of instability?
6 dB is a factor of 10^(6/20) ≈ 2. In the lesson the margin is 6.02 dB, exactly 2: K = 4 can double to 8, where the closed loop oscillates for ever.
04On the Nyquist plot, where do you see the phase margin?
|L| = 1 on the unit circle. The curve crosses it at ∠L = −152.9°, which is 27.1° short of −1 (at −180°). That angle is the phase margin.
05Why does a pure time delay in the loop eat into the phase margin but not the gain margin?
A delay of T seconds multiplies L by e^(−jωT): size 1, angle −ωT. It shifts the phase curve down without moving the magnitude curve, so the phase margin shrinks first.
المسرد
- Open-loop transfer function L(s)
- Everything once round the loop with the loop cut, here K·G(s). Margins are read from L, not from the closed loop.
- Phase crossover frequency ω180
- The frequency where ∠L(jω) = −180°. Here √3 = 1.73 rad/s, whatever K is.
- Gain margin (GM)
- 1 / |L(jω180)|, often given in dB: how many times the gain could grow before the closed loop reaches the edge of stability.
- Gain crossover frequency ωc
- The frequency where |L(jω)| = 1 (0 dB).
- Phase margin (PM)
- 180° + ∠L(jωc): how much extra phase lag the loop could take before the closed loop reaches the edge of stability.
- Critical point −1
- L(jω) = −1 means a sine comes back the same size and inverted; through the minus sign of negative feedback it sustains itself.
- Decibel (dB)
- 20·log10 of a gain ratio. A factor of 2 is 6.02 dB; 1 is 0 dB.
الملاحظات والمصادر
- The loop is L(s) = K/(s+1)³ with unity negative feedback. Every curve is computed from that formula; the step responses are simulated from the closed-loop equation y''' + 3y'' + 3y' + (1 + K)y = Kr.
- The Python on the margin steps is plain Python 3 (math only): a bisection finds each crossover, then one line reads the margin. python-control's control.margin returns the same four numbers.
- The targets of more than 6 dB gain margin and 30° to 60° phase margin are guidelines from Ogata (Modern Control Engineering, §7-7), not laws. Exact overshoot from phase margin is the subject of the next lesson.
- Margins read at a single crossover can mislead when a Bode plot crosses 0 dB or −180° more than once, or when the open loop is itself unstable. Then go back to the full Nyquist plot.
- K. Ogata, Modern Control Engineering, 5th ed., Pearson (ch. 7, §7-7 relative stability analysis)
- N. S. Nise, Control Systems Engineering, 8th ed., Wiley (ch. 10, frequency response techniques)
- G. F. Franklin, J. D. Powell, A. Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson (ch. 6)
- MIT OpenCourseWare 16.06 Principles of Automatic Control (S. Hall)
- MIT OpenCourseWare 6.302 Feedback Systems (Roberge, Dawson, Lundberg)
- python-control documentation: control.margin
- python-control documentation: control.stability_margins
اختبار يتاح بعد الخطوة الأخيرة.