Bode/Nyquist Control Lab

move poles with sliders and see robustness margins change instantly

Loading interactive simulation...

Lesson

The theory — Bode/Nyquist Control Lab

The Nyquist stability criterion settles whether a feedback loop is stable by counting instead of solving. Plot the open-loop response G(jω) on the complex plane, count how many times the curve wraps around the point −1 + j0, and add the number of unstable poles the loop already had before it was closed: Z = N + P. Any Z other than zero means the closed loop runs away.

What each symbol means

P
the number of poles of the open-loop G(s) that already sit in the right half-plane, counted before the loop is closed. For the plant on this page it is always 0.
N
the number of clockwise encirclements of −1 + j0 made by the Nyquist curve. Anticlockwise turns count as negative, so N can be below zero.
Z
the number of closed-loop poles in the right half-plane — the answer you actually wanted. Z = 0 is stability; anything else is not.
−1 + j0
the critical point, drawn in red on the Nyquist panel. It is where the loop gain is exactly 1 with exactly 180° of lag: a signal sent once around the loop returns the same size and upside down.

Where the formula comes from

  1. Ask the question properly. With unity negative feedback the closed-loop response is G/(1 + G), so its poles are the zeros of 1 + G(s). Stability collapses to one question: does 1 + G(s) have any zeros in the right half of the complex plane? Finding them means factoring a polynomial you may not even possess.
  2. Count them rather than find them. The argument principle says that when s travels once clockwise around a closed contour, the image of 1 + G(s) winds around the origin exactly as many times as the zeros inside, minus the poles inside. Winding around the origin of 1 + G is the same motion as winding around −1 of G — which is why the critical point sits where it does, and why it is −1 and not some other number.
  3. Choose the contour to be the entire right half-plane: up the imaginary axis, back around an infinite semicircle. Now "inside the contour" and "unstable" mean the same thing. The enclosed zeros are Z, the enclosed poles are P, the winding count is N, and the argument principle reads N = Z − P — rearranged, Z = N + P. Along the imaginary axis s = jω, and G(jω) is the frequency response: the curve this page already draws.
  4. That last sentence is the whole payoff. Nothing in the count requires a model. G(jω) can be measured — shake real hardware with sine waves, record what returns — so you can get a stability verdict on a system nobody ever wrote an equation for. Gain and phase margin are then two ways of asking how widely the measured curve misses −1: one along the negative real axis, one around the unit circle.

How to read what you see

All three panels show the open loop — G(jω) by itself, with the feedback path not yet connected — while the two margins beneath them describe what happens once it is. So the magnitude peak near ωn, and the ωr and Mr in the table, belong to G and not to the closed loop you are designing. On the Nyquist panel the solid curve is ω running from zero upward and the dashed curve is its mirror for negative ω. You need both: an encirclement only exists once the contour closes, and a frequency sweep can only ever measure half of one. The arrows give the direction of travel, which is what decides whether a wrap counts as clockwise.

Assumes
Unity negative feedback, and a known P. This page never asks you for P — it takes it as zero, which is correct here only because the damping slider stops at ζ = 0.05 and both poles stay in the left half-plane for every setting you can reach. Hand the same criterion a plant that is already unstable open-loop and a curve making no encirclements means the exact opposite of what it means here. It also assumes nothing cancelled on the way round: a right-half-plane pole cancelled by a zero disappears from G(s) while remaining in the hardware, and the count will then certify a loop that still runs away.
Breaks when
Nyquist returns yes or no about one exact model, and hardware is neither exact nor stationary. Z = 0 tells you the nominal loop is stable and nothing whatever about how far a gain has to drift, or a temperature move, before it is not — which is why this page prints two margins instead of the single word "stable". The margins are themselves optimistic, because each is measured with the other held still: a loop can show a comfortable gain margin and a comfortable phase margin while a modest change in both at once walks the curve straight through −1. The honest number is the shortest distance from the curve to the critical point, in any direction at all, and no panel here draws it.

You cannot destabilize this loop with gain 🖖

Each of the two poles contributes at most 90° of lag, and only reaches its full 90° at infinite frequency, so the phase of K·ωn²/(s² + 2ζωns + ωn²) approaches −180° without ever arriving. Push all three sliders to their limits and it still stops at −179.99°. That is why the gain margin reads ∞: the Nyquist curve never wraps around −1, and raising K only stretches it. Instability here needs a third source of lag — an extra pole, an integrator, a transport delay — not more gain.

Predicting oscillation without solving equations 🖖

Instead of solving the differential equation, you can shake the system with sine waves across many frequencies and watch how it answers. The Bode plot records how much each frequency is amplified and how far it is delayed in phase. Trouble appears where the gain passes 0 dB while the phase nears −180°: feedback then reinforces itself and the loop rings. Phase margin measures how far you sit from that edge — more margin means calmer, steadier control.

Phase margin sets a hidden delay budget 🖖

A healthy phase margin quietly tells you how much pure time delay the loop can survive. A delay adds phase lag that grows with frequency (−ωτ), so it drains margin fastest where the loop is busiest. The tolerable delay is roughly τ = PM / ωc, with PM in radians and ωc the gain-crossover frequency. So a fast, wide-bandwidth loop can be wrecked by a few milliseconds of sensor lag that a slower loop with the same margin shrugs off.

Common wrong intuition

Higher gain does not always mean better control. It can improve speed while quietly destroying robustness margins.

Problem solved in full

  1. A resonant peak of 1.0002 and an infinite gain margin 6 steps

    A second-order loop with ζ = 0.7. The panel reports a resonant peak of 1.0002 and an infinite gain margin. Explain both.

    1. The standard second-order form, with the three parameters the sliders set. Everything below is read off the denominator.

    2. The poles are the roots. The real part is the decay rate and the imaginary part is the ringing frequency, and both are visible in the step response.

    3. The resonant frequency is not the natural frequency. The square root under it can vanish, which is the whole of the next step.

    4. It vanishes at ζ = 1/√2. At 0.7 the system is barely inside the peaked region, and the peak is 0.002 dB — present in the algebra and invisible on any plot.

    5. Now the phase. Each pole contributes a lag that approaches 90°, so two of them approach 180° from above and never cross it.

    6. No crossing means no gain margin to speak of, which is what the panel reports.

    Answer

    ζ = 0.7 sits just below 1/√2, and two poles cannot reach −180°. The resonant frequency carries √(1 − 2ζ²), which vanishes at ζ = 0.7071 — so 0.7 is 0.001 inside the region where a peak exists at all, and the peak it has is 1.0002, or 0.002 dB. That threshold is the Butterworth condition, and it is why 0.707 is the damping every filter textbook reaches for: it is the most responsive setting that still has no peak. The infinite gain margin is a stronger statement and a more dangerous one. Each pole contributes at most 90° of lag, so two of them approach 180° and never arrive, and no amount of gain will make this loop oscillate. Real loops always do oscillate eventually — the third pole, the transport delay, the unmodelled resonance — so an infinite gain margin is a reliable sign that the model is missing something, not that the hardware is safe.

References (2)

Example problems

  • stable baseline - K = 1 gives unity DC gain, a crossover at 0.60 rad/s and a phase margin of 163.74°. Nothing here is anywhere near trouble.
  • near oscillation - The least stable preset on the tool: phase margin 16.70° with a resonant peak of 16.44 dB, which leaves a tolerable delay of only 52 ms.
  • slow but robust - K = 0.8 and ζ = 0.9, so the gain never reaches 0 dB at all. There is no crossover frequency, the phase margin is infinite, and no amount of delay can destabilise it.
  • high-gain risk - Named for risk, and it is the safer of the two tight presets: phase margin 21.66° against Near oscillation's 16.70°, because ζ = 0.35 against 0.2 more than pays for K = 4.2 against 2.6.