Skip to content
Automatic Controls 1

Bode plots and the Nyquist criterion in depth: rules, resonance, criterion proved and margins

Bode plot asymptotes and errors, second-order resonance proved, minimum phase, delays and unstable zeros, argument principle and Nyquist criterion proved, gain, phase and delay margins, MATLAB and Python examples.

This page goes deeper into the lesson on the Nyquist criterion and stability margins. It derives the rules for drawing Bode plots by hand (asymptotes, errors, second-order resonance, delays, non-minimum-phase zeros), proves the Nyquist criterion from the argument principle, explains how to deal with an integrator or an open-loop unstable process, and links gain, phase and delay margins to performance. At the end are the examples in MATLAB and Python, with verified code.

Why Bode plots are drawn by adding

A rational transfer function can be written as a product of elementary factors:

    \[ L(s) = K\,\frac{\prod_i(1 + s/z_i)\cdot\prod_k\left(1 + 2\zeta_k\frac{s}{\omega_k} + \frac{s^2}{\omega_k^2}\right)}{s^h\prod_j(1 + s/p_j)\cdot\prod_l\left(1 + 2\zeta_l\frac{s}{\omega_l} + \frac{s^2}{\omega_l^2}\right)} \]

With s = i\omega, the logarithm turns the product into a sum: 20\log_{10}|L| = \sum 20\log_{10}|\text{factor}| and \arg L = \sum\arg(\text{factor}). So it is enough to know the plots of the elementary factors and add them.

The simple pole \frac{1}{1 + i\omega/p}: magnitude -10\log_{10}\left(1 + \frac{\omega^2}{p^2}\right) dB.

  • For \omega \ll p it is about 0 dB; for \omega \gg p it is -20\log_{10}\frac{\omega}{p}: a straight line with slope −20 dB per decade that crosses 0 dB at \omega = p. The two lines are the asymptotes.
  • The largest error is at the corner: -10\log_{10}2 = -3.01 dB. One octave away (\omega = p/2 or 2p) the error is -10\log_{10}1.25 = -0.97 dB.
  • The phase -\arctan\frac{\omega}{p} is -45° at \omega = p and goes from 0 to -90°; the piecewise approximation makes it fall linearly between p/10 and 10p, with a maximum error of about 5.7°.

The zero gives the same plots with the opposite sign; the integrator \frac{1}{s} is a line at −20 dB per decade at all frequencies, with constant phase -90°.

Bode plots with the asymptotes
For 100 times s plus 1 over s times s plus 10, the actual magnitude in blue and the dashed asymptotes: slope minus 20 dB per decade for the integrator, flat between 1 and 10 because of the zero, minus 20 again after the pole at 10. The actual phase, in red, rises towards minus 45 degrees and then returns to minus 90.

Second-order resonance

Theorem. The system G(s) = \frac{\omega_n^2}{s^2 + 2\zeta\omega_ns + \omega_n^2}, with \zeta \lt  \frac{1}{\sqrt 2}, has a resonant peak at \omega_r = \omega_n\sqrt{1 - 2\zeta^2}, of height

    \[ M_r = \frac{1}{2\zeta\sqrt{1 - \zeta^2}} \]

For \zeta \ge \frac{1}{\sqrt 2} the magnitude is decreasing and there is no peak.

Proof. With u = \omega/\omega_n: |G|^{-2} = (1 - u^2)^2 + 4\zeta^2u^2. Look for the minimum of this function of v = u^2: f(v) = (1 - v)^2 + 4\zeta^2v, f'(v) = -2(1 - v) + 4\zeta^2 = 0, v = 1 - 2\zeta^2, acceptable only if positive. There f = 4\zeta^4 + 4\zeta^2(1 - 2\zeta^2) = 4\zeta^2(1 - \zeta^2), and M_r = f^{-1/2}. ∎

With \zeta = 0.1 the peak is M_r = 5.03, i.e. 14 dB; with \zeta = 0.2, 8.1 dB; with \zeta = 0.4, 2.7 dB. At \omega = \omega_n the phase is always -90°. The asymptote error (the asymptote has a corner at 0 dB at \omega_n and then falls by 40 dB per decade) can be large: for lightly damped systems Bode cannot be drawn with straight lines alone.

Second-order resonance
The magnitude in decibels of a second-order system for five values of damping: with zeta 0.1 the peak exceeds 13 dB, with zeta 0.707 and 1 there is no peak; beyond the natural frequency all curves fall by 40 dB per decade.

Minimum phase, delays, unstable zeros

A system with no poles or zeros in the right half-plane and no delays is called minimum phase. For these systems the phase is determined by the magnitude (Bode’s gain-phase relation): where the magnitude falls with a constant slope of -20n dB per decade, the phase approaches -90n degrees. This is why, in design, one tries to cross 0 dB with a slope of −20 dB per decade: the phase is then around -90°, far from -180°.

Two important exceptions:

  • a delay e^{-s\tau} has magnitude 1 and phase -\omega\tau (in radians), which grows without limit: it does not change the magnitude but removes phase margin, the more so the higher the crossover frequency;
  • a zero in the right half-plane, like 1 - s/z, has the same magnitude as the stable zero but a phase that falls instead of rising. The system \frac{1 - s}{1 + s} has magnitude 1 at all frequencies and phase from 0 to -180°. In time, an unstable zero makes the step response start in the wrong direction (undershoot): this happens in boost converters, in aircraft pitch dynamics, in the drum level of a boiler.
Effect of a delay on the Bode plots
The system 2 over s plus 1 with a delay of 0.6 seconds: the magnitude does not change, but the phase, in red, falls much faster than without the delay, dashed in grey, and the phase margin goes from 120 to about 60 degrees.

The Nyquist criterion, proved

Argument principle. Let F(s) be a rational function and \Gamma a closed curve, traversed clockwise, that does not pass through zeros or poles of F. If inside \Gamma there are Z zeros and P poles of F (counted with multiplicity), the image curve F(\Gamma) goes round the origin Z - P times clockwise.

Proof. Writing F(s) = c\,\frac{\prod(s - z_i)}{\prod(s - p_j)}, we have \arg F = \arg c + \sum\arg(s - z_i) - \sum\arg(s - p_j). When s goes once round \Gamma clockwise, the vector s - z_i rotates by -360° if z_i is inside the curve and returns to the same angle (zero change) if it is outside. So the total change in the argument of F is -360°\cdot(Z - P): Z - P clockwise turns. In integral form it is \frac{1}{2\pi i}\oint\frac{F'}{F}ds = Z - P (with the curve traversed anticlockwise), a direct consequence of the residue theorem, because \frac{F'}{F} has residue +1 at each simple zero and -1 at each simple pole. ∎

The criterion. Apply the principle to F = 1 + L, with \Gamma the Nyquist contour: the imaginary axis from -iR to +iR and a semicircle of radius R \to \infty in the right half-plane, which therefore encloses the whole right half-plane. The zeros of 1 + L are the closed-loop poles; the poles of 1 + L are those of L. Going round the origin with 1 + L is the same as going round -1 with L. On the large semicircle L \to 0 (proper systems), and the image shrinks to a point: it is enough to draw L(i\omega). This gives

    \[ Z = N + P \]

with N the clockwise turns round -1, P the poles of L in the right half-plane, Z the closed-loop poles in the right half-plane. ∎

Poles on the imaginary axis. If L has poles on the axis (for example an integrator at 0), the contour goes round them with small semicircles of radius \varepsilon \to 0 to the right, leaving them outside. For a simple pole at 0, L \approx \frac{K}{s} and on s = \varepsilon e^{i\theta}, with \theta from -90° to +90°, the image is \frac{K}{\varepsilon}e^{-i\theta}: a semicircle of infinite radius traversed clockwise, which closes the plot “from infinity”.

The Nyquist contour
The closed curve goes up the imaginary axis, goes round the right half-plane along a semicircle of radius R tending to infinity, and goes round the pole at the origin with a small semicircle of radius epsilon; it encloses all the unstable poles, marked in purple.

Margins and robustness

With \omega_c the crossover frequency (|L| = 1) and \omega_\pi the frequency where the phase is -180°:

  • gain margin G_m = \frac{1}{|L(i\omega_\pi)|}: the factor by which the gain can be multiplied before instability;
  • phase margin \varphi_m = 180° + \arg L(i\omega_c): the extra phase lag that can be tolerated;
  • delay margin \tau_m = \frac{\varphi_m}{\omega_c} (with \varphi_m in radians): the pure delay that would cause instability. It is the most meaningful margin in systems controlled by a processor or through a network;
  • sensitivity peak M_s = \max\frac{1}{|1 + L(i\omega)|}: the inverse of the minimum distance of the Nyquist plot from -1. Typical design values: M_s \lt  2 (6 dB), which guarantees G_m \gt  2 and \varphi_m \gt  29°.

Example. For L = \frac{4}{s(s + 1)(s + 2)}: \omega_\pi = \sqrt 2, |L(i\sqrt 2)| = \frac{4}{\sqrt 2\cdot\sqrt 3\cdot\sqrt 6} = \frac{2}{3}, G_m = 1.5 (3.5 dB); \omega_c = 1.14 rad/s, \varphi_m = 11.4°, delay margin 0.17 s. The system is stable but fragile: the step response has an overshoot of 70 %.

Gain and phase margins on the Bode plots
For 4 over s times s plus 1 times s plus 2: the phase margin, in green, is the distance of the phase from minus 180 degrees at the crossover frequency; the gain margin, in purple, is the distance of the magnitude from 0 dB at the frequency where the phase is minus 180. Both are small.
Nyquist plot of the same system
The curve, which comes from infinity at the bottom because of the integrator, crosses the negative real half-axis at minus 2 thirds, to the right of minus 1 but close to it: the critical point is not encircled, the closed loop is stable with small margins.

Bode and Nyquist in MATLAB and Python

MATLAB:

L = tf(4, [1 3 2 0]);           % L(s) = 4/(s(s+1)(s+2))
margin(L)                        % Bode with the margins written on the plot
[Gm, Pm, Wpc, Wgc] = margin(L)
nyquist(L)
step(feedback(L, 1))

Python (numpy and python-control):

import numpy as np
import control as ct

L = ct.tf([4], [1, 3, 2, 0])            # L(s) = 4/(s(s+1)(s+2))
gm, pm, wpc, wgc = ct.margin(L)
print(f"Gm = {gm:.2f} ({20*np.log10(gm):.1f} dB) at {wpc:.3f} rad/s")
print(f"PM = {pm:.1f} degrees at {wgc:.3f} rad/s")
print(f"delay margin = {np.radians(pm)/wgc:.3f} s")
T = ct.feedback(L, 1)
print(f"overshoot = {ct.step_info(T)['Overshoot']:.0f} %")

Running it prints G_m = 1.50 (3.5 dB) at 1.414 rad/s, \varphi_m = 11.4° at 1.143 rad/s, delay margin 0.174 s and overshoot 70 %. The plots are obtained with ct.bode_plot(L, dB=True, margins=True) and ct.nyquist_plot(L), which use matplotlib.

Exercises with hand-drawn plots, margins, delays and open-loop unstable systems are on the exercise page linked at the top.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x