Skip to content
Tutorials Center
My learning

Topics

Lesson 22 of 37 · Root Locus and Frequency Response

Nyquist Plots and Stability Margins

Use the Nyquist criterion to judge closed-loop stability from the open-loop frequency response, and compute gain margin, phase margin and delay margin from scratch.

The root locus needs a model with polynomial coefficients. The Nyquist criterion works from the open-loop frequency response alone, so it also works on measured data and on systems with time delays that have no finite polynomial. It answers: "given the open-loop L(jω), is the closed loop stable?" and, just as important, "how far from instability am I?"

The headline answer is two numbers, the gain margin and the phase margin, which tell you how much gain or phase lag you can add before the loop goes unstable. Real hardware always has unmodelled lags and uncertain gains, so a design with healthy margins is a design that survives contact with reality.

The Nyquist plot

The Nyquist plot is the curve L(jω) in the complex plane as ω runs from -∞ to +∞. The point -1 is special: if L(jω) = -1 for some ω, then 1 + L = 0, which means the loop has a closed-loop pole on the imaginary axis.

The Nyquist criterion counts encirclements:

TEXT
Z = N + P
  • P: number of open-loop poles in the right half plane.
  • N: number of clockwise encirclements of -1 by the plot.
  • Z: number of closed-loop poles in the right half plane. The loop is stable only if Z = 0.

For the common case P = 0, the loop is stable if the plot does not encircle -1.

Counting encirclements numerically

For L(s) = K / (s+1)³ (no open-loop RHP poles) the loop is stable for K < 8. We can count the winding of the Nyquist curve around -1 by tracking the angle of 1 + L(jω).

Python Nyquist encirclements for K = 4 and K = 10

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For K < 8 the plot misses -1 and N = 0; for K > 8 it encircles -1 twice clockwise, so Z = 2: two unstable closed-loop poles. The np.roots check agrees.

Gain and phase margins

Margins are measured at two special frequencies:

  • Gain crossover frequency ωgc: where |L(jω)| = 1 (0 dB).
  • Phase crossover frequency ωpc: where the phase of L(jω) is -180°.

Then:

  • Phase margin PM = 180° + ∠L(jωgc): extra phase lag you can add at crossover before instability.
  • Gain margin GM = 1 / |L(jωpc)|: factor by which the gain can grow before instability (often quoted in dB, -20·log10|L(jωpc)|).

Rules of thumb: PM of 45–60° and GM above 6 dB (a factor of 2) are typical targets. A PM near 60° gives a well-damped response; a PM under 30° rings badly. For a dominant second-order loop, ζ ≈ PM/100 (with PM in degrees, up to about 60°) is a handy estimate.

flowchart LR
    A["Compute L(jw) on a fine grid"] --> B["Find w where |L| = 1"]
    B --> C["PM = 180 + phase there"]
    A --> D["Find w where phase = -180"]
    D --> E["GM = 1 / |L| there"]

Reading both margins from the open-loop response.

Computing the margins from scratch

Take L(s) = K / (s(s+1)(s+2)) with K = 2. We know from the root locus that instability starts at K = 6, so we expect GM = 6/2 = 3 (9.54 dB).

Python Gain margin, phase margin, delay margin

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The delay margin DM = PM(rad)/ωgc is the extra pure time delay that would take the loop to the edge of instability, a very physical number: "this loop dies if the network adds another 0.5 seconds of latency."

Margins and closed-loop behavior

How do margins show up in a step response? Let us check by simulating the closed loop for three gains and measuring overshoot against the phase margin.

Python Phase margin versus overshoot

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

More gain pushes the gain crossover higher, where the phase is worse, so PM falls and overshoot rises. This is the classic trade-off: speed versus robustness.

Margins can be misleading on their own. A system can have large gain and phase margins yet pass very close to -1 at some other frequency. Check the sensitivity peak Ms = max|1/(1+L(jω))|; it is the inverse of the shortest distance from the Nyquist curve to -1. Keeping Ms below about 2 is a more robust requirement than the two margins alone.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. In the Nyquist criterion Z = N + P, what does P count?

    P is the number of open-loop right-half-plane poles; N counts clockwise encirclements of -1; Z is the number of unstable closed-loop poles.
  2. 2. Phase margin is measured at the frequency where:

    Phase margin is 180 degrees plus the phase of L at the gain crossover frequency, where |L| = 1.
  3. 3. A loop has |L(j w_pc)| = 0.25 at the phase crossover. What is the gain margin?

    GM = 1/|L(j w_pc)| = 4, so the gain can grow fourfold (12 dB) before instability.
  4. 4. Why does extra time delay reduce phase margin?

    e^(-sT) has unit magnitude and phase -wT, so the Nyquist curve rotates clockwise toward -1.

Summary

  • The Nyquist criterion Z = N + P decides closed-loop stability from L(jω).
  • Phase margin is measured at |L| = 1; gain margin at phase -180°.
  • Typical targets: PM 45–60°, GM above 6 dB; check the sensitivity peak too.
  • Delay margin PM/ωgc expresses robustness in seconds.
  • Raising gain increases speed but erodes margins.

Next: PID Controller Basics