26. Nyquist Stability and Margins

Lecture 26: Nyquist Stability: Worked Example, Gain and Phase Margins

Introduction

A Nyquist sketch must contain enough geometric information to determine the signed encirclements of $-1$. Endpoints alone are often insufficient, especially when the loop has unstable poles. We construct a second-order example by calculating its axis crossings, then use the curve to find the stabilizing range of positive gain. This example leads naturally to gain and phase margins and to the effect of simultaneous gain and phase uncertainty. Because the curve of this example never meets the unit circle, the margins are also read on the fifth-order loop used in Lectures 23 to 25. Negative unity feedback and counterclockwise-positive image winding are used throughout. The video lecture writes $\tilde G(s)$ for the open loop $L(s)$; the examples and numbers are the same.

Video lecture

The lecture is presented in one video, Nyquist Stability: Worked Example, Gain and Phase Margins (with Python).

Chapters: 0:00 A loop that fails when the gain drops · 1:32 The criterion and the plan · 2:34 Real and imaginary parts of G(jω) · 3:48 Crossing the imaginary axis · 4:43 Crossing the real axis at -4/3 · 5:46 Drawing the curve and counting encirclements · 6:45 Gain scaling and the exact stability interval · 8:52 Checking the worked example in Python · 10:28 The gain margin · 12:14 The phase margin · 13:29 Reading the margins from Bode plots · 15:37 Gain and phase together: the distance to -1 · 16:54 The margins in Python · 18:03 Three things to keep

Lecture materials

  • Fill-in skeleton slides, to print or annotate and fill in while watching the video: PDF

The lecture notes are on this page. Exercises with answers are at the end.

A loop with two unstable poles

Consider a loop with poles at $2$ and $4$ and zeros at $-3$ and $-5$. The two unstable poles require two net counterclockwise encirclements of $-1$ for closed-loop stability. We first draw the response at unit gain, then use radial scaling to study other positive gains.

$$ L_K(s)=K\frac{(s+3)(s+5)}{(s-2)(s-4)},\qquad L_1(0)=\frac{15}{8},\quad L_1(\infty)=1. $$

The poles at $2$ and $4$ give $P=2$. No imaginary-axis indentation is needed. This loop is proper but not strictly proper, so its large-radius arc approaches $K$, not zero. Begin with $K=1$. To draw the curve faithfully, find the imaginary- and real-axis crossings, place them in frequency order, and then add the conjugate branch.

The closed loop at $K=1$ has poles at $-0.5\pm j3.354$ and is stable. Lowering the gain to $K=0.7$ moves them to $0.118\pm j3.297$, an unstable loop, while raising it to $K=10$ moves them to $-3.364\pm j1.746$. In this loop a drop in gain is the danger. Both ends of the frequency response, $15/8$ and $1$, lie to the right of $-1$, yet stability requires two counterclockwise encirclements, so the path between the ends must be computed.

A loop with two unstable poles

Substitute s equal to j omega

The low- and high-frequency values locate the ends of the positive-frequency branch, but the path between them remains unknown. Substituting $s=j\omega$ and expanding the polynomial factors is the first step toward finding its axis crossings.

$$ \begin{aligned}(j\omega+3)(j\omega+5)&=15-\omega^2+8j\omega,\\(j\omega-2)(j\omega-4)&=8-\omega^2-6j\omega,\\L_1(j\omega)&=\frac{15-\omega^2+8j\omega}{8-\omega^2-6j\omega}.\end{aligned} $$

The DC value and high-frequency limit locate the endpoints, but they do not determine the intermediate path. Expand the products, using $(j\omega)^2=-\omega^2$, so that the real and imaginary parts of each polynomial are visible. The next operation is division by a complex number. Multiply numerator and denominator by $8-\omega^2+6j\omega$ to make the denominator real.

Separate real and imaginary parts

To locate those crossings, write the complex quotient in terms of its real and imaginary parts. Multiplication by the conjugate denominator gives both parts a common real denominator. Its positivity allows the crossing conditions to be read from the numerator alone.

$$ L_1(j\omega)=\frac{\omega^4-71\omega^2+120+j\,14\omega(11-\omega^2)}{(8-\omega^2)^2+36\omega^2}. $$

The common denominator is strictly positive for real $\omega$. Thus an imaginary-axis crossing requires the real numerator to vanish; a real-axis crossing requires the imaginary numerator to vanish. These are different conditions. Preserve the $j^2=-1$ sign in the cross term: $(8j\omega)(6j\omega)=-48\omega^2$. With the opposite sign the real numerator would be $\omega^4+25\omega^2+120$, which never vanishes, and the curve would seem never to cross the imaginary axis.

Collect the conjugate-product terms

The conjugate-product calculation is worth carrying out explicitly because its signs control the sketch. Products of two imaginary terms contribute to the real part with a negative sign; the cross terms supply the imaginary part. Collecting them gives two real polynomials in frequency.

$$ \begin{aligned}D_\omega&=(8-\omega^2)^2+36\omega^2,\\A_\omega&=(15-\omega^2)(8-\omega^2)-48\omega^2,\\B_\omega&=6\omega(15-\omega^2)+8\omega(8-\omega^2),\\L_1(j\omega)&=(A_\omega+jB_\omega)/D_\omega.\end{aligned} $$

The product of the two imaginary terms is $(8j\omega)(6j\omega)=-48\omega^2$ and belongs in the real numerator. The two cross terms belong in the imaginary numerator. Expanding gives $A_\omega=\omega^4-71\omega^2+120$ and $B_\omega=154\omega-14\omega^3$. Since $D_\omega$ is positive on the real frequency axis, axis crossings can be found directly from these numerator polynomials.

Imaginary-axis crossings

An imaginary-axis crossing occurs when the real part of the loop response vanishes. Its numerator is an even polynomial, so introducing $x=\omega^2$ reduces the crossing condition to a quadratic. Positive roots in $x$ give the positive crossing frequencies.

$$ x^2-71x+120=0,\qquad x=\frac{71\pm\sqrt{4561}}{2}. $$

The two positive frequencies are approximately $1.3162$ and $8.3227$ rad/s. The corresponding values of $L_1$ are approximately $+j1.6800$ and $-j1.0867$. The negative frequencies yield conjugate values. These checks anchor the curve and rule out a simple direct path from the initial point to the final point.

Place crossings in frequency order

The crossing frequencies determine when the curve meets the imaginary axis, but not the crossing heights. Substituting them into the imaginary part gives those coordinates. Placing the resulting points in increasing frequency order constrains the intermediate path and its orientation.

$$ \begin{array}{c|c}\omega&L_1(j\omega)\\\hline0&15/8\\1.3162&j1.6800\\8.3227&-j1.0867\\\infty&1\end{array} $$

The smaller positive root of the quadratic is reached first. Substitute each crossing frequency into $B_\omega/D_\omega$ to find its height on the imaginary axis. Join the points in increasing frequency order, with arrows. The connection between the two imaginary-axis crossings must cross the real axis; its location is still unknown. It matters because it determines whether the connection passes to the left or the right of $-1$.

Place crossings in frequency order

Solve the real-axis crossing condition

The crossing location follows by setting the imaginary numerator to zero. Besides the known zero-frequency point, the equation gives a nonzero positive frequency. Substitution into the real part gives the negative-real coordinate, whose position relative to $-1$ decides the count in the next section.

$$ \begin{aligned}B_\omega&=2\omega[3(15-\omega^2)+4(8-\omega^2)]\\&=14\omega(11-\omega^2),\\\omega&=0,\ \pm\sqrt{11},\\L_1(j\sqrt{11})&=\frac{121-781+120}{9+396}=-\frac43.\end{aligned} $$

The zero-frequency root is the known starting point. The nonzero roots give the additional real-axis crossing. Since $1.3162\lt \sqrt{11}\lt 8.3227$, the crossing occurs between the two imaginary-axis crossings, as required by the sketch. This frequency, $\omega_{\mathrm{pc}}=\sqrt{11}=3.3166$ rad/s, is the phase-crossover frequency of the loop. The crossing point $-4/3\approx-1.333$ lies to the left of $-1$, at distance $1/3$.

The negative-real crossing and encirclements

With the real-axis crossing known, the positive-frequency branch can be drawn through its five points in order of frequency. The position of this crossing relative to $-1$ is decisive for the winding count. For unit gain it lies to the left of the critical point, producing the encirclements needed to stabilize the two unstable poles.

$$ \begin{array}{c|c}\omega&L_1(j\omega)\\\hline0&15/8\\1.3162&j1.6800\\\sqrt{11}=3.3166&-4/3\\8.3227&-j1.0867\\\infty&1\end{array} $$

The positive frequencies take the curve once around the origin, counterclockwise. The negative frequencies give the mirror image in the real axis, and the large arc maps to the single point $K=1$. A vector from $-1$ to the moving point turns twice counterclockwise over the whole contour, giving $N_{\mathrm{CCW}}=2$. With $P=2$, Nyquist gives $Z=0$. Direct verification at $K=1$ yields the characteristic polynomial $2s^2+2s+23$, whose roots are $-0.5\pm j\sqrt{45}/2$. Both have negative real part.

The negative-real crossing and encirclements

Gain scaling and the exact stability interval

Once the unit-gain curve is known, changing a positive scalar gain requires no new frequency calculation. Every image point moves radially by the same factor. The stability boundary occurs when the negative-real crossing reaches $-1$, and the characteristic polynomial provides an independent check of the resulting gain interval.

$$ (1+K)s^2+(8K-6)s+(8+15K)=0,\qquad K\gt 0:\quad \text{stable iff }K\gt \frac34. $$

The boundary occurs when $-4K/3=-1$, so $K_{\mathrm{crit}}=0.75$. At the boundary the roots are $\pm j\sqrt{11}$, so the system is not asymptotically stable. For $0\lt K\lt 0.75$, there are two RHP roots; for $K\gt 0.75$, there are none. Relative to nominal $K=1$, the downward gain factor is $0.75$, or $20\log_{10}(0.75)\approx-2.499$ dB. There is no finite upper positive-gain stability boundary for this ideal model.

Gain scaling and the exact stability interval

The critical gain reaches minus one

The geometric effect of the critical gain is now explicit. At the boundary, the frequency response passes through $-1$ and the closed loop has imaginary-axis characteristic roots. Further contraction and expansion place the curve on opposite sides of this boundary, so their effects on stability are different.

$$ \begin{aligned}L_K(j\sqrt{11})&=-4K/3,\\-4K/3=-1&\ \Longrightarrow\ K_{\mathrm{crit}}=3/4,\\0\lt K\lt 3/4:&\quad N_{\mathrm{CCW}}=0,\ Z=2,\\K\gt 3/4:&\quad N_{\mathrm{CCW}}=2,\ Z=0.\end{aligned} $$

Multiplication by a positive gain scales every coordinate by the same amount without changing phase or crossing frequency. At $K=3/4$, the curve touches $-1$ and the characteristic roots are $\pm j\sqrt{11}$. Further shrinking removes the two encirclements. Enlarging preserves them. This example therefore has a lower gain boundary; an increase in positive gain has no finite stability boundary in this ideal model.

Checking the worked example in Python

The first Python script checks the worked example with python-control (tested with version 0.10.2); the code calls the loop G. It computes the closed-loop poles at the three gains of the opening, sweeps the gain to locate the boundary, and counts the encirclements of $-1$.

# Python demo 1: a loop with two unstable poles, G(s) = K (s+3)(s+5) / ((s-2)(s-4))
# Closed-loop poles at three gains, the stability boundary from a gain sweep,
# and the encirclement count of the Nyquist plot.
# Needs: numpy, matplotlib, python-control (tested with 0.10.2).
import numpy as np
import control as ct
import matplotlib.pyplot as plt

s = ct.tf('s')
G = (s + 3)*(s + 5) / ((s - 2)*(s - 4))
G = ct.tf(G, name='G')   # label for plots

for K in [0.7, 1, 10]:
    T = ct.feedback(K*G, 1)
    print(K, np.round(ct.poles(T), 3))

def stable(K):
    return all(ct.poles(ct.feedback(K*G, 1)).real < 0)

Ks = np.linspace(0.5, 1.0, 501)
ok = [stable(K) for K in Ks]
print("first stable K:", Ks[ok.index(True)])

print(ct.nyquist_response(G).count)
print(ct.nyquist_response(0.5*G).count)

ct.nyquist_plot(G)
plt.savefig("python_demo_01_nyquist.png", dpi=150)
plt.show()

The script prints

0.7 [0.118+3.297j 0.118-3.297j]
1 [-0.5+3.354j -0.5-3.354j]
10 [-3.364+1.746j -3.364-1.746j]
first stable K: 0.751
-2
0

At $K=0.7$ the real part of the closed-loop poles is positive, so that loop is unstable; at $K=1$ and $K=10$ it is negative. The sweep tests $501$ gains from $0.5$ to $1$ and reports $0.751$, the first grid point above the exact boundary $3/4$. At $K=0.75$ itself the poles lie on the imaginary axis and the strict test fails. python-control counts clockwise encirclements as positive, so its count is $-N_{\mathrm{CCW}}$. The value $-2$ at $K=1$ means $N_{\mathrm{CCW}}=2$ and $Z=0$, and the value $0$ at $K=0.5$ means $N_{\mathrm{CCW}}=0$ and $Z=2$.

The gain margin

The factor by which the gain can change before a crossing of the negative real axis reaches $-1$ is the gain margin. At a phase-crossover frequency $\omega_{\mathrm{pc}}$ the curve meets the negative real axis, and

$$ \mathrm{GM}=\frac{1}{|L(j\omega_{\mathrm{pc}})|},\qquad \mathrm{GM}_{\mathrm{dB}}=-20\log_{10}|L(j\omega_{\mathrm{pc}})|. $$

For the worked example at $K=1$, $\omega_{\mathrm{pc}}=\sqrt{11}$ and $|L_1(j\sqrt{11})|=4/3$, so $\mathrm{GM}=0.75$, or $-2.50$ dB. A factor below one means that the gain may only decrease, here by $2.50$ dB, while any increase is allowed.

Most loops in practice have a stable open loop, and then the danger lies in an increase of gain. The fifth-order loop used in Lectures 23 to 25, $L(s)=K/(s(s+1)(s+2)(s+3)(s+4))$, crosses the negative real axis at $-K/30.09$, at $\omega_{\mathrm{pc}}=0.836$ rad/s. At $K=10$ the crossing is at $-0.332$, and the gain may rise by a factor of $3.01$, to $K=30.09$, before the crossing reaches $-1$. The gain margin of this loop at $K=10$ is therefore $\mathrm{GM}=3.01$, or $9.57$ dB, an allowed increase. The encirclement count agrees: $N_{\mathrm{CCW}}=0$ at $K=10$ and at $K=30$, while $K=40$ gives $N_{\mathrm{CCW}}=-2$ and $Z=2$.

Phase margin as an angular clearance

Gain scaling changes distance from the origin. A phase perturbation instead changes angle, which motivates measuring angular clearance at a point where the loop magnitude is one. Such a point lies on the unit circle and can reach $-1$ through a change of phase alone.

$$ |L(j\omega_{\mathrm{gc}})|=1,\qquad \mathrm{PM}=180^\circ+\angle L(j\omega_{\mathrm{gc}}). $$

This is the usual additional-phase-lag convention for an appropriate stable nominal SISO loop and a selected gain crossover. Evaluate the continuous phase branch consistently. Multiple crossovers or unstable open-loop poles require the full Nyquist stability assessment; a single positive margin is not a universal stability proof. A physical real-coefficient perturbation also preserves conjugate symmetry; the rotation illustrates the positive-frequency geometry. For the fifth-order loop at $K=10$, the curve meets the unit circle at $\omega_{\mathrm{gc}}=0.378$ rad/s with $\angle L=-134.0^\circ$, so $\mathrm{PM}=46.0^\circ$; an added lag of $46.0^\circ$, from a time delay or unmodeled dynamics, would rotate that point onto $-1$. The worked example has no such point. Since $|L_1(j\omega)|^2-1=(14\omega^2+161)/D_\omega\gt 0$, its magnitude exceeds one at every finite frequency, the curve never meets the unit circle, and no phase margin can be read; python-control reports it as infinite.

Phase margin as an angular clearance

Read margins from Bode plots

The same conditions can be read from Bode plots because they display the magnitude and phase of the same complex response. A magnitude of one corresponds to 0 dB, and the negative real axis corresponds to an odd multiple of $180^\circ$. Matching the appropriate crossings gives the conventional margin constructions.

$$ \begin{aligned}\omega_{\mathrm{pc}}&=0.836\ \text{rad/s}:&|L(j\omega_{\mathrm{pc}})|&=-9.57\ \text{dB},&\mathrm{GM}&=9.57\ \text{dB},\\\omega_{\mathrm{gc}}&=0.378\ \text{rad/s}:&\angle L(j\omega_{\mathrm{gc}})&=-134.0^\circ,&\mathrm{PM}&=46.0^\circ.\end{aligned} $$

At a phase crossover the phase is an odd multiple of $180^\circ$; read the gain change needed to reach 0 dB. At a gain crossover, read the angular distance from the relevant $-180^\circ$ branch. Retain the direction of the gain change: a lower gain boundary such as $0.75$ must not be misreported as tolerance to an increase.

For the fifth-order loop at $K=10$, the phase reaches $-180^\circ$ at $\omega_{\mathrm{pc}}=0.836$ rad/s, where the magnitude is $-9.57$ dB, so the magnitude curve may rise by $9.57$ dB. The magnitude crosses 0 dB at $\omega_{\mathrm{gc}}=0.378$ rad/s, where the phase is $-134.0^\circ$, which is $46.0^\circ$ above $-180^\circ$. Raising $K$ from $10$ to $40$ shifts the magnitude curve up by $20\log_{10}4=12.04$ dB, more than the margin, which is why that loop is unstable at $K=40$; the boundary $K=30.09$ is the gain at which the shift equals the margin. For the worked example the phase passes $+180^\circ$ at $\sqrt{11}=3.32$ rad/s, where the magnitude is $+2.50$ dB. Its magnitude must come down by $2.50$ dB to reach 0 dB, so that margin is a decrease.

Read margins from Bode plots

The Bode plot of the fifth-order loop at $K=10$ below marks both readings. At $\omega_{\mathrm{pc}}=0.836$ rad/s the magnitude lies $9.57$ dB below 0 dB, and at $\omega_{\mathrm{gc}}=0.378$ rad/s the phase lies $46.0^\circ$ above $-180^\circ$.

Bode plot of the fifth-order loop with the gain and phase margins marked

Joint gain and phase uncertainty

Separate gain and phase margins consider one type of change at a time. Real uncertainty can change both together, so a broader geometric view asks how close the loop curve comes to $-1$. This distance also connects the Nyquist picture to the sensitivity function $S(s)=1/(1+L(s))$.

$$ d_{\min}=\min_\omega|1+L(j\omega)|,\qquad S(s)=\frac{1}{1+L(s)}. $$

The distance from a point on the loop curve to $-1$ is $|1+L(j\omega)|$. Its minimum is the modulus margin, which is related to the peak sensitivity by $d_{\min}=1/\|S\|_\infty$ when the frequency supremum is appropriate. For the fifth-order loop at $K=10$, $d_{\min}=0.530$ at $\omega=0.573$ rad/s, between the two crossovers. The two margin points are farther from $-1$: the gain-margin point $-0.332$ at distance $0.668$ and the phase-margin point $e^{-j134.0^\circ}$ at distance $0.781$. The peak sensitivity is $1/d_{\min}=1.89$, or $5.51$ dB. A small $d_{\min}$ means a large sensitivity peak and a loop close to instability, even when both margins look comfortable. Robust control develops this picture into the disk margin, which asks how much the gain and the phase can change at the same time before the loop loses stability. A formal disk margin describes an admissible family of simultaneous multiplicative gain and phase perturbations; it is not in general the same as the shortest Euclidean distance. The geometric motivation is to prevent the perturbed loop curve from reaching the critical point.

Joint gain and phase uncertainty

The figure below draws these quantities to scale for the fifth-order loop at $K=10$. The disk of radius $d_{\min}=0.530$ about $-1$ touches the curve at $\omega=0.573$ rad/s, while the gain-margin point $-0.332$ ($\omega_{\mathrm{pc}}=0.836$ rad/s) and the phase-margin point $e^{-j134.0^\circ}$ ($\omega_{\mathrm{gc}}=0.378$ rad/s) lie outside it; the arc of the unit circle from the phase-margin point to $-1$ spans the phase margin of $46.0^\circ$.

Fifth-order loop near -1 with the margin points, the unit circle and the d_min disk

The margins in Python

The second script computes the margins of the fifth-order loop at $K=10$ with one call to stability_margins, which returns the gain margin, the phase margin, $d_{\min}$ and the three frequencies at which they are read. It then draws the Bode plot with both margins marked and applies margin to the worked example.

# Python demo 2: gain margin, phase margin and d_min of the fifth-order loop
# G5(s) = 10 / (s(s+1)(s+2)(s+3)(s+4)), the Bode plot with both margins marked,
# and the margins of the two-unstable-pole loop for comparison.
# Needs: numpy, matplotlib, python-control (tested with 0.10.2).
import numpy as np
import control as ct
import matplotlib.pyplot as plt

s = ct.tf('s')
G5 = 10 / (s*(s + 1)*(s + 2)*(s + 3)*(s + 4))
G5 = ct.tf(G5, name='G5')   # label for plots

gm, pm, dmin, wpc, wgc, wd = ct.stability_margins(G5)
gm_dB = 20*np.log10(gm)
print("GM:", round(gm, 2), "=", round(gm_dB, 2), "dB")
print("PM:", round(pm, 1), "deg")
print("w_pc, w_gc:", round(wpc, 3), round(wgc, 3))
print("d_min:", round(dmin, 3), "at", round(wd, 3))

ct.bode_plot(G5, dB=True, display_margins=True)
plt.savefig("python_demo_02_bode.png", dpi=150)

G = (s + 3)*(s + 5) / ((s - 2)*(s - 4))
gm1, pm1, wpc1, wgc1 = ct.margin(G)
print("worked example GM:", gm1, "PM:", pm1)
plt.show()

The script prints

GM: 3.01 = 9.57 dB
PM: 46.0 deg
w_pc, w_gc: 0.836 0.378
d_min: 0.53 at 0.573
worked example GM: 0.75 PM: inf

These are the values read from the Nyquist and Bode plots above. For the worked example, margin returns a gain margin of $0.75$, a factor below one and therefore a decrease, and an infinite phase margin, because that curve never meets the unit circle.

Perspective

Axis crossings and traversal directions turn an approximate Nyquist drawing into a stability calculation. In the worked example, the stabilizing condition is $K\gt 3/4$ for positive gain, illustrating that reducing gain can destabilize a loop with unstable poles. Gain and phase margins describe selected ways of reaching the critical point, while the sensitivity relation helps interpret joint changes. All of these measures must be read in the context of the complete Nyquist count.

This completes the technical frequency-domain sequence.

Exercises

Try each exercise before opening its answer.

Exercise 1. The loop $L_K(s)=\dfrac{K}{s(s+1)(s+5)}$ has $P=0$; its pole at the origin is excluded by a small indentation of the contour. For $K=6$, find the phase-crossover frequency $\omega_{\mathrm{pc}}$, the point where the Nyquist curve meets the negative real axis, and the gain margin as a factor and in dB. At what gain does the curve pass through $-1$, and where are the closed-loop roots at that gain?

Answer

Substituting $s=j\omega$ gives

$$ j\omega(j\omega+1)(j\omega+5)=-6\omega^2+j\omega(5-\omega^2),\qquad L_K(j\omega)=\frac{K}{-6\omega^2+j\omega(5-\omega^2)}. $$

The imaginary part vanishes at a finite nonzero frequency when $\omega^2=5$, so $\omega_{\mathrm{pc}}=\sqrt5\approx2.236$ rad/s. There the denominator equals $-30$, and $L_6(j\sqrt5)=-6/30=-0.2$. Hence $\mathrm{GM}=1/0.2=5$, or $\mathrm{GM}_{\mathrm{dB}}=20\log_{10}5\approx13.98$ dB. In this loop the margin is a tolerance to an increase in gain. The crossing point $-K/30$ reaches $-1$ at $K_{\mathrm{crit}}=30$, where the characteristic polynomial $s^3+6s^2+5s+30=(s+6)(s^2+5)$ has roots $-6$ and $\pm j\sqrt5$. For $0\lt K\lt 30$ the crossing lies to the right of $-1$, so $N_{\mathrm{CCW}}=0$ and $Z=0$. For $K\gt 30$ the curve encircles $-1$ twice clockwise, so $N_{\mathrm{CCW}}=-2$ and $Z=2$.

Exercise 2. For $L_K(s)=\dfrac{K}{s(s+1)}$ with $K=10$, find the gain-crossover frequency $\omega_{\mathrm{gc}}$ and the phase margin. Then find the gain $K$ that gives a phase margin of $45^\circ$, together with the new $\omega_{\mathrm{gc}}$.

Answer

The magnitude condition $|L_K(j\omega)|=K/(\omega\sqrt{1+\omega^2})=1$ becomes $x^2+x-K^2=0$ with $x=\omega^2$. For $K=10$,

$$ x=\frac{-1+\sqrt{401}}{2}\approx9.5125,\qquad \omega_{\mathrm{gc}}\approx3.084\ \text{rad/s}. $$

The phase there is $\angle L_{10}(j\omega_{\mathrm{gc}})=-90^\circ-\tan^{-1}(3.084)\approx-162.04^\circ$, so $\mathrm{PM}\approx17.96^\circ$. A phase margin of $45^\circ$ requires a phase of $-135^\circ$ at crossover, so $\tan^{-1}\omega_{\mathrm{gc}}=45^\circ$ and $\omega_{\mathrm{gc}}=1$ rad/s. The magnitude condition at $\omega=1$ then gives $K/\sqrt2=1$, so $K=\sqrt2\approx1.414$. The closed-loop poles move from $-0.5\pm j3.122$ at $K=10$ to $-0.5\pm j1.079$ at $K=\sqrt2$, and the damping ratio rises from $0.158$ to $0.420$. The phase of this loop approaches $-180^\circ$ only as $\omega\to\infty$, so its gain margin is infinite for every $K\gt 0$.

Exercise 3. Consider $L_K(s)=\dfrac{K}{(s-1)(s+2)(s+3)}$ with $K\gt 0$. (a) Find $P$ and the points where the Nyquist curve meets the real axis, as functions of $K$. (b) Use the encirclement count to find the range of $K$ for closed-loop stability, and confirm it with the characteristic polynomial. (c) At $K=8$, by what factor can the gain decrease, and by what factor can it increase, before the closed loop becomes unstable?

Answer

(a) The pole at $1$ gives $P=1$, so stability requires $N_{\mathrm{CCW}}=1$. Expanding, $(s-1)(s+2)(s+3)=s^3+4s^2+s-6$, and at $s=j\omega$

$$ L_K(j\omega)=\frac{K}{-(6+4\omega^2)+j\omega(1-\omega^2)}. $$

The imaginary part vanishes at $\omega=0$ and $\omega=1$, which gives the real-axis points $L_K(0)=-K/6$ and $L_K(j1)=-K/10$. For $0\lt \omega\lt 1$ the positive-frequency branch lies below the real axis; for $\omega\gt 1$ it lies above the axis and approaches the origin. Adding the conjugate branch produces a counterclockwise loop between $-K/6$ and $-K/10$ and a clockwise loop between $-K/10$ and $0$.

(b) For $K\lt 6$ the point $-1$ lies outside both loops, so $N_{\mathrm{CCW}}=0$ and $Z=1$. For $6\lt K\lt 10$ it lies inside the counterclockwise loop, so $N_{\mathrm{CCW}}=1$ and $Z=0$. For $K\gt 10$ it lies inside the clockwise loop, so $N_{\mathrm{CCW}}=-1$ and $Z=2$. The closed loop is therefore stable exactly for $6\lt K\lt 10$. The characteristic polynomial $s^3+4s^2+s+(K-6)$ gives the same interval, since the Routh conditions are $K-6\gt 0$ and $4\cdot1\gt K-6$. At $K=6$ the roots are $0$, $-0.268$ and $-3.732$; at $K=10$ they are $-4$ and $\pm j$.

(c) From $K=8$ the gain can fall by a factor of $0.75$ ($-2.50$ dB) or rise by a factor of $1.25$ ($+1.94$ dB). Because the open loop is unstable, there is both a lower and an upper limit, and both should be reported with their directions. Even at $K=8$ the curve passes within $0.044$ of $-1$ near $0.72$ rad/s, so this loop is stable but fragile.

Exercise 4. The Bode plots of a loop with $P=0$ and a stable closed loop show a single gain crossover at $\omega_{\mathrm{gc}}=1.5$ rad/s, where the phase is $-140^\circ$, and a single phase crossover at $\omega_{\mathrm{pc}}=4$ rad/s, where the magnitude is $-8$ dB. (a) State the gain margin, as a factor and in dB, and the phase margin. (b) Locate the two corresponding points on the Nyquist plot and find the distance from each to $-1$. What do these distances say about $d_{\min}$? (c) Working in the opposite direction, the Nyquist curve of another such loop crosses the negative real axis only at $-0.25$ and the unit circle only at $-0.5736-j0.8192$. What gain and phase margins would its Bode plots show?

Answer

(a) $\mathrm{GM}_{\mathrm{dB}}=8$ dB, so $\mathrm{GM}=10^{8/20}\approx2.512$, and $\mathrm{PM}=180^\circ-140^\circ=40^\circ$.

(b) At the phase crossover the response is real and negative with magnitude $10^{-8/20}\approx0.3981$, so the Nyquist point is $-0.3981$, at distance $0.6019$ from $-1$. At the gain crossover the point lies on the unit circle at angle $-140^\circ$, which is $e^{-j140^\circ}\approx-0.7660-j0.6428$. Its distance from $-1$ is $2\sin(\mathrm{PM}/2)=2\sin 20^\circ\approx0.6840$. The minimum over all frequencies can only be smaller than either value, so $d_{\min}\le 0.6019$ and $\|S\|_\infty\ge 1/0.6019\approx1.661$. The two margins therefore give upper bounds on $d_{\min}$; they do not give its value.

(c) A crossing at $-0.25$ means $|L(j\omega_{\mathrm{pc}})|=0.25$, which the magnitude plot shows as $-12.04$ dB at the phase crossover. Thus $\mathrm{GM}=4$, or $12.04$ dB. The unit-circle point has magnitude $1$ and angle $-125.0^\circ$, so the phase plot reads $-125^\circ$ where the magnitude crosses 0 dB, and $\mathrm{PM}=55^\circ$.

Exercise 5. The loop

$$ L(s)=\frac{4(s^2+0.2s+1)}{s(s+1)(s+10)(s^2+0.06s+1)} $$

has $P=0$ and a stable closed loop. It has one gain crossover and one phase crossover, with $\mathrm{GM}\approx27.1$ dB at $\omega_{\mathrm{pc}}\approx2.87$ rad/s and $\mathrm{PM}\approx70.8^\circ$ at $\omega_{\mathrm{gc}}\approx0.376$ rad/s, so both margins are generous by the usual guidelines. Its Nyquist curve nevertheless passes within $0.334$ of $-1$ near $\omega\approx1.02$ rad/s. Explain how both statements can hold, what combined change in the loop would bring the curve to $-1$, and why a large gain margin alone is weak evidence of robustness.

Answer

The gain margin measures the distance from $-1$ only along the negative real axis at the phase crossover, and the phase margin measures angular clearance only on the unit circle at the gain crossover. Neither one examines the rest of the curve. In this loop the lightly damped poles of $s^2+0.06s+1$, only partly offset by the better-damped zeros of $s^2+0.2s+1$, raise the magnitude to a local maximum of about $0.94$ near $1$ rad/s and add phase lag just above that frequency. This happens between $\omega_{\mathrm{gc}}$ and $\omega_{\mathrm{pc}}$, so both margins miss it.

At $\omega\approx1.02$ rad/s, $|L|\approx0.751$ and $\angle L\approx-165.2^\circ$. The distance to $-1$ is $d_{\min}\approx0.334$, and the peak sensitivity is $\|S\|_\infty=1/d_{\min}\approx2.99$, or $9.5$ dB. Multiplying the loop by $1.33$ ($2.5$ dB) and adding $14.8^\circ$ of lag at that frequency would place the curve on $-1$, although the gain change is far below $27.1$ dB and the phase change is far below $70.8^\circ$. The margins only bound the distance from above, $d_{\min}\le 1-1/\mathrm{GM}\approx0.956$ and $d_{\min}\le 2\sin(\mathrm{PM}/2)\approx1.158$, and here the actual value is much smaller.

A large gain margin by itself says even less. The loop of Exercise 2 with $K=10$ has an infinite gain margin, yet its phase margin is $18^\circ$ and $d_{\min}\approx0.298$. For this reason the minimum distance $d_{\min}$, or equivalently the peak of $|S(j\omega)|$, should be checked together with the two margins.

The numerical answers above were checked with a short Python script that computes the margins with python-control, the closed-loop roots with numpy, and the encirclement counts by tracking the angle of $1+L$ along a densely sampled Nyquist contour.

References

Norman S. Nise, Control Systems Engineering, 6th ed., Wiley, 2011.

  • §§10.4–10.7: Nyquist construction, stability, and margins.
  • §6.2: Routh-Hurwitz stability check.
  • §7.7: Sensitivity.