Lecture 25: Nyquist Plots with Imaginary-Axis Poles: Contour Detours
Introduction
The ordinary Nyquist contour follows the imaginary axis and closes through the right half-plane. This construction needs modification when an open-loop pole lies on the imaginary axis, because a contour used in the argument principle cannot pass through a pole. Small detours keep the mapping finite before a limit is taken. The examples below show how to map those detours for an integrator, a double integrator, and poles at nonzero imaginary frequencies. The stability convention remains $Z=P-N_{\mathrm{CCW}}$, where $P$ counts poles strictly inside the modified contour. The video lecture writes $\tilde G(s)$ for the open loop $L(s)$ and $\tilde G_0(s)$ for the factor $L_0(s)$ introduced below; the examples and numbers are the same.
Video lecture
The lecture is presented in one video, Nyquist Plots with Imaginary-Axis Poles: Contour Detours (with Python).
Chapters: 0:00 A stable loop whose Nyquist plot does not close · 2:26 The contour must not pass through a pole · 3:27 A pole sliding toward the origin · 5:09 Stepping around the pole · 6:24 A small detour becomes a large arc · 8:07 The integrator, piece by piece · 9:06 Closing the motor loop · 9:53 Checking it in Python (python-control and numpy) · 11:55 Two poles at the same point · 14:29 Poles at plus and minus j · 16:09 The indented Nyquist contour, and what comes next
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 stable motor loop whose Nyquist plot does not close
A position loop for a small DC motor shows why the ordinary contour is not enough. The motor angle is the integral of its speed, so the open loop has a pole at the origin:
$$ L(s)=\frac{8}{s(s+4)},\qquad L(j\omega)=-\frac{8}{\omega^2+16}-j\,\frac{32}{\omega(\omega^2+16)}. $$With unity feedback the characteristic polynomial is $s^2+4s+8$, whose roots $-2\pm j2$ give a stable closed loop with damping ratio $0.707$. The frequency response does not show this directly. At $\omega=1$ the response is $-0.47-j1.88$, at $\omega=0.1$ it is $-0.50-j19.99$, and as $\omega\to0^+$ it runs off along the vertical asymptote $\Re L=-1/2$. The negative frequencies give the mirror image above the real axis. The curve therefore has two open ends far apart, and the encirclements of $-1$ cannot be counted until we know how the ends are joined. Joined by a large arc on the right, the curve would leave $-1$ outside; joined on the left, it would enclose $-1$. The sections below show how the contour itself decides the closure, and the section on closing the motor loop completes this example. Exercise 1 treats the same loop for general $K$ and $a$.
A pole approaching the origin
A useful way to approach an imaginary-axis pole is to move a stable real pole toward the origin. For $L(s)=1/(s+a)$ with $a\gt 0$, the ordinary Nyquist image is a circle. Following this family as $a$ decreases reveals which part of the image becomes singular in the integrator limit.
$$ L(j\omega)=\frac{a-j\omega}{a^2+\omega^2},\qquad \left(\Re L-\frac{1}{2a}\right)^2+(\Im L)^2=\frac{1}{4a^2}. $$Compare $a=10,1,0.5$ before considering the integrator. The circle expands as $a$ decreases. At any fixed nonzero frequency, the limit is $1/(j\omega)$. This limit is not uniform near zero frequency: part of the circle moves to infinity. An integrator is not BIBO stable; the phrase marginal pole refers here to its location on the imaginary axis.
Why the origin needs a detour
The expanding circle shows why simply setting $a=0$ loses information near zero frequency. The finite-frequency limit exists away from the origin, but a portion of the image moves without bound. We need a contour that avoids the singular point while preserving the connection between the branches.
$$ \begin{aligned}a\gt 0:&\quad L(0)=1/a,\\a\to0^+:&\quad 1/a\to\infty,\\a=0:&\quad L(j\omega)=-j/\omega.\end{aligned} $$The examples $a=10,1,0.5$ start at $0.1,1,2$ on the real axis. Their Nyquist circles grow as the pole moves toward the origin. In the integrator limit, the finite-frequency branches approach the imaginary axis, but a connection remains at infinity. Simply substituting $\omega=0$ is impossible. A small detour makes every point of the contour finite first, so that its image and orientation can be determined before taking a limit. At $a=0.01$ the circle is already $100$ units wide, while the point at $\omega=1$ has settled near its limit $1/j=-j$, at $0.010-j1.000$.
Indent the contour around a boundary pole
A small semicircular indentation into the right half-plane supplies that connection in the domain. It excludes the boundary pole from the enclosed region and avoids evaluating the transfer function at the pole itself. The detour must be mapped before its radius is allowed to tend to zero.
$$ L(s)=\frac{L_0(s)}{s},\qquad s=\epsilon e^{j\theta},\qquad -\frac{\pi}{2}\leq\theta\leq\frac{\pi}{2}. $$Traverse the indentation from $-j\epsilon$ to $+j\epsilon$, counterclockwise around the excluded pole. The rest of the overall right-half-plane contour retains its clockwise orientation. Count strictly right-half-plane poles inside the modified contour; the excluded boundary pole is not added to $P$. Take $R\to\infty$ and $\epsilon\to0^+$ only after the complete mapped contour has been constructed. For the motor loop, the pole at the origin is excluded and the pole at $-4$ lies in the left half-plane, so $P=0$.
The straight branches of an integrator
With the modified contour specified, begin by mapping its straight imaginary-axis segments for the integrator $L(s)=1/s$. These give the familiar frequency branches. They must then be connected by the images of the large outer semicircle and the small indentation.
$$ L(j\omega)=-\frac{j}{\omega},\qquad L(Re^{j\theta})=\frac{1}{R}e^{-j\theta}\longrightarrow0. $$The positive-frequency branch moves from a large negative imaginary value toward zero. The negative-frequency branch is the conjugate reflection, traversed from near zero toward a large positive imaginary value. The large domain semicircle maps to a small arc near the origin. The missing connection is supplied by the indentation, not by an arbitrary line.
A small domain arc maps to a large image arc
The missing distant connection comes from the indentation. Near a simple pole at the origin, write $L(s)=L_0(s)/s$ with $L_0(0)\ne0$. Substituting the small semicircle shows that its radius is inverted and its angular direction is reversed.
$$ L(\epsilon e^{j\theta})\sim\frac{c}{\epsilon}e^{-j\theta},\qquad c=L_0(0). $$We call $c=L_0(0)$ the local coefficient. For the integrator, $c=1$. The image angle decreases from $+90^\circ$ to $-90^\circ$, yielding a clockwise right semicircle of radius $1/\epsilon$. Shrinking the detour from $\epsilon=0.5$ to $0.25$ and then $0.2$ enlarges the image arc from radius $2$ to $4$ and $5$; it remains a clockwise half turn. If $c$ is another nonzero number, its magnitude scales the arc and its phase rotates it. For the motor loop, $c=8/4=2$, so the arc has radius $2/\epsilon$, which is $200$ for $\epsilon=0.01$. With unity negative feedback, $1/s$ gives $T=1/(s+1)$, a stable closed-loop check of the full contour.
Track the four segment endpoints
The full integrator image is now determined, but tracking the segment endpoints makes its orientation easier to verify. Both domain semicircles map to image semicircles, with radii inverted. The two arcs connect the positive- and negative-frequency branches at different scales.
$$ \begin{aligned}\Gamma_1:&\ -j/\epsilon\ \to -j/R,\\\Gamma_2:&\ -j/R\ \to +j/R,\\\Gamma_3:&\ +j/R\ \to +j/\epsilon,\\\Gamma_4:&\ +j/\epsilon\ \to -j/\epsilon.\end{aligned} $$For $L=1/s$, the two imaginary-axis pieces are joined by two right semicircles: a small one of radius $1/R$ and a large one of radius $1/\epsilon$. On $\Gamma_2$, the domain angle decreases, so the image angle increases from $-\pi/2$ to $+\pi/2$. On $\Gamma_4$, the domain angle increases, so the image angle decreases from $+\pi/2$ to $-\pi/2$. Keeping both arcs resolves the apparent missing connection.
Closing the motor loop
The motor loop of the opening section can now be closed. Its factor $L_0(s)=8/(s+4)$ gives $c=2$, so the detour around the origin maps to a clockwise half circle of radius $2/\epsilon$ through the right half-plane.
$$ L(\epsilon e^{j\theta})\approx\frac{2}{\epsilon}e^{-j\theta},\qquad P=0,\quad N_{\mathrm{CCW}}=0,\quad Z=P-N_{\mathrm{CCW}}=0. $$For $\epsilon=0.01$ the arc crosses the positive real axis at $L(0.01)=199.50$ and meets the two frequency branches at $L(\mp j0.01)\approx-0.50\pm j200.00$. Its angle changes by $-180.29^\circ$, which tends to $-180^\circ$ as $\epsilon\to0^+$. Every point of the closed curve has $\Re L\ge-0.5$, so a ray from $-1$ pointing left meets no part of it and $N_{\mathrm{CCW}}=0$. With $P=0$ the count gives $Z=0$, in agreement with the closed-loop poles $-2\pm j2$ found at the start.
The figure below draws the motor loop with a detour of radius $\epsilon=0.5$, so that the arc fits beside $-1$. The left panel shows the two frequency branches alone; they leave the picture along $\Re L=-1/2$ as $\omega\to0$. In the right panel the image of the detour joins them, running clockwise from $-0.49+j3.94$ through $L(0.5)=3.56$ to $-0.49-j3.94$ with a radius close to $2/\epsilon=4$, and the closed curve leaves $-1$ outside, so $N_{\mathrm{CCW}}=0$.
A detour to the left of the origin is also legitimate. The pole is then inside the contour, so $P=1$, and the detour image turns counterclockwise through the left half-plane, crossing the negative real axis near $-200$. It encircles $-1$ once, $N_{\mathrm{CCW}}=+1$, and again $Z=0$. Joining the open ends on the left by hand while keeping $P=0$ would give $Z=-1$, which is impossible.
Checking the motor loop in Python
The same conclusions take a few lines of Python; the code calls the loop G. The first script uses python-control (tested with version 0.10.2). Its function nyquist_response builds an indented contour, by default with a detour of radius $10^{-4}$ to the right of each imaginary-axis pole, maps it, and counts the encirclements of $-1$. python-control counts clockwise encirclements as positive, so its count equals $-N_{\mathrm{CCW}}$, and $Z=P+\mathrm{count}$.
# Lecture 25, Python demo 1: the motor loop G(s) = 8/(s(s + 4)) with python-control.
# python-control counts clockwise turns around -1 as positive:
# count = -N_CCW and Z = P + count.
import matplotlib.pyplot as plt
import numpy as np
import control as ct
# open loop G(s) = 8 / (s (s + 4))
G = ct.tf([8], [1, 4, 0])
print(G.poles())
# Nyquist count; indent right, radius 1e-4
resp = ct.nyquist_response(G)
print(resp.count)
# where does the contour start?
s = resp.contour
print(s[0], round(abs(G(s[0])), 1))
# detour on the left: pole inside, P = 1
left = ct.nyquist_response(
G, indent_direction='left')
print(left.count)
# closed-loop poles
T = ct.feedback(G, 1)
print(T.poles())
# the plot (the large arc is not to scale)
ct.nyquist_plot(G)
plt.show()
The script prints
[-4.+0.j 0.+0.j]
0
(0.0001+0j) 19999.5
-1
[-2.+2.j -2.-2.j]
With the default detour the count is $0$, so $Z=0$. The contour starts at $s=10^{-4}$, where $|L|=19999.5$, close to $c/\epsilon=2\times10^4$. With indent_direction='left' the pole at the origin lies inside the contour and $P=1$; the count $-1$ means one counterclockwise turn, $N_{\mathrm{CCW}}=1$, and again $Z=0$. The closed-loop poles from feedback confirm the result. In the figure drawn by nyquist_plot, the large arc is compressed onto a circle of radius $15$ (the setting max_curve_magnitude) and drawn with dash-dot and dotted lines. Read the direction of travel through the right half-plane from the plot and the size from the numbers: the true radius is about $20\,000$.
The second script makes the same count with numpy alone. It samples the four pieces $\Gamma_1$ to $\Gamma_4$ with $\epsilon=0.01$ and $R=100$, unwraps the angle of $1+L$ along them, and divides the net change by $2\pi$.
# Lecture 25, Python demo 2: the same count with numpy. Unwrap the angle of
# 1 + G on an indented contour (eps = 0.01, R = 100), then check the roots.
import numpy as np
G = lambda s: 8 / (s * (s + 4))
eps, R, n = 0.01, 100.0, 20000
th = np.linspace(-np.pi/2, np.pi/2, n)
w = np.linspace(eps, R, n)
s = np.concatenate([
1j * w, # Gamma 1
R * np.exp(-1j * th), # Gamma 2
-1j * w[::-1], # Gamma 3
eps * np.exp(1j * th), # Gamma 4
])
a = np.unwrap(np.angle(1 + G(s)))
print(round((a[-1] - a[0]) / (2*np.pi), 3))
print(np.roots([1, 4, 8]))
It prints 0.0, the value of $N_{\mathrm{CCW}}$, and the closed-loop roots [-2.+2.j -2.-2.j], so $Z=0$.
A repeated stable pole
Before increasing the boundary-pole multiplicity, consider a repeated pole that remains in the left half-plane. The loop $1/(s+1)^2$ needs no indentation, but its two denominator factors double the high-frequency phase contribution. This separates the effect of multiplicity from the need to modify the contour.
$$ L(j\omega)=\frac{1-\omega^2-2j\omega}{(1+\omega^2)^2},\qquad \angle L(j\omega)=-2\tan^{-1}\omega. $$The curve starts at $1$ and approaches the origin from below along the negative-real direction: its phase tends to $-180^\circ$, not $-90^\circ$. Under unity feedback the characteristic roots are $-1\pm j$, confirming stability.
A double pole at the origin
Moving both poles to the origin introduces both effects at once. For $L(s)=1/s^2$, the frequency branches lie on the negative real axis, while the indentation image makes a full turn. The complete traversal is therefore essential even though the finite-frequency sketch looks simple.
$$ L(j\omega)=-\frac{1}{\omega^2},\qquad L(\epsilon e^{j\theta})=\epsilon^{-2}e^{-2j\theta}. $$Both frequency branches lie on the negative real axis, with opposite traversal directions. Across the indentation, $\theta$ increases by $\pi$ and the image phase decreases by $2\pi$: a full clockwise turn at large radius. More generally, $L_0(s)/s^m$ contributes an image phase change of $-m\pi$ on that detour if $L_0(0)\ne0$. For unity feedback, $1/s^2$ has characteristic roots $\pm j$; the frequency curve passes through $-1$ at $\omega=1$, so strict asymptotic stability is not obtained.
Double integrator: twice the angular change
The full turn can be verified directly from the angular parameter. A semicircle changes the domain angle by $\pi$; the reciprocal-square factor changes the image angle by $-2\pi$. The starting and ending image points coincide geometrically, but the unwrapped angle records the intervening rotation.
$$ \begin{aligned}s&=\epsilon e^{j\theta},\quad\theta:-\pi/2\to\pi/2,\\s^{-2}&=\epsilon^{-2}e^{-2j\theta},\\\arg(s^{-2})&:\quad \pi\to-\pi.\end{aligned} $$The negative-frequency straight segment ends at $-1/\epsilon^2$, on the negative real axis. The indentation starts there with unwrapped angle $\pi$ and finishes at the same geometric point with angle $-\pi$. Thus it contributes a full clockwise turn, not a half circle. The two straight branches overlap geometrically but run in opposite directions. Their coincident appearance must not erase either part of the traversal.
A short numpy check samples the detour with $\epsilon=0.5$ and unwraps the angle of $1/s^2$:
# Lecture 25, Python demo 3: the detour image of 1/s^2 turns once clockwise.
import numpy as np
th = np.linspace(-np.pi/2, np.pi/2, 1001)
s = 0.5 * np.exp(1j * th) # detour, eps = 0.5
a = np.unwrap(np.angle(1 / s**2))
print(np.degrees(a[-1] - a[0]).round(2))
print(round(abs(1 / s[0]**2), 3))
It prints -360.0 and 4.0: a full clockwise turn of radius $1/\epsilon^2=4$.
Poles away from the origin on the imaginary axis
The same local reasoning applies to a boundary pole away from the origin. For $L(s)=1/(s^2+1)$, separate detours are required around $+j$ and $-j$. Expanding about each pole gives a reciprocal local coordinate, multiplied by a coefficient that rotates and scales the image arc.
$$ s=-j+\epsilon e^{j\theta},\qquad s^2+1=-2j\epsilon e^{j\theta}+\epsilon^2e^{2j\theta}. $$The term linear in $\epsilon$ dominates the quadratic term as the detour shrinks. Therefore $L(s)\sim[-2j\epsilon e^{j\theta}]^{-1}$. A matching detour is needed around $+j$. Track the local residue as well as the inverse radius; it determines the orientation and phase offset of each large image arc. Under unity feedback, the characteristic equation is $s^2+2=0$, with imaginary-axis roots $\pm j\sqrt{2}$. This is a boundary case, not asymptotic stability.
Expand locally about the pole at minus j
To see that coefficient explicitly, expand first about $s=-j$. The constant denominator terms cancel at the pole, leaving a leading term proportional to the detour radius. The corresponding calculation about $+j$ gives the companion arc with its own phase offset.
$$ \begin{aligned}s&=-j+\epsilon e^{j\theta},\\s^2+1&=(-j)^2-2j\epsilon e^{j\theta}\\&\hspace{8mm}+\epsilon^2e^{2j\theta}+1,\\L(s)&\sim\frac{j}{2\epsilon}e^{-j\theta}.\end{aligned} $$The constant terms $(-j)^2$ and $1$ cancel. The term of order $\epsilon$ dominates the term of order $\epsilon^2$, leaving the local coefficient $j/2$. The image has radius approximately $1/(2\epsilon)$ and angle $\pi/2-\theta$. Around $+j$, the coefficient is $-j/2$, so the companion arc has angle $-\pi/2-\theta$. Each detour reverses its angular direction in the image, with a different phase offset. Together the two detour images form one full clockwise circle of radius $1/(2\epsilon)$: the arc around $-j$ runs from angle $\pi$ to $0$ over the top, and the arc around $+j$ from $0$ to $-\pi$ under the bottom. The frequency branches lie on the real axis, $L(j\omega)=1/(1-\omega^2)$, and pass through $-1$ at $\omega=\sqrt2$, the frequency of the closed-loop roots $\pm j\sqrt2$. A curve through $-1$ admits no count; it signals closed-loop poles on the imaginary axis.
The indented Nyquist contour
The contour built in this lecture, with a small detour to the right of every open-loop pole on the imaginary axis, is called the indented Nyquist contour. The criterion is unchanged, $Z=P-N_{\mathrm{CCW}}$, with $P$ counting only the open-loop poles with $\Re s\gt 0$. Near an imaginary-axis pole $p$ of order $m$ the loop behaves like $c/(s-p)^m$, and the detour maps to a large clockwise arc:
$$ L(s)\approx\frac{c}{(s-p)^m},\qquad L(p+\epsilon e^{j\theta})\approx\frac{|c|}{\epsilon^m}e^{j(\angle c-m\theta)},\qquad \Delta\angle L=-m\pi. $$The radius is $|c|/\epsilon^m$, the angle of $c$ rotates the arc, and the arc turns by $-m\pi$.
This settles the fifth-order loop used in Lectures 23 and 24, $L(s)=K/(s(s+1)(s+2)(s+3)(s+4))$. Its pole at the origin has $c=L_0(0)=K/24$, so the detour image is a clockwise half circle of radius $K/(24\epsilon)$, about $416.7$ for $K=10$ and $\epsilon=10^{-3}$, far from $-1$. python-control makes this detour by itself:
# Lecture 25, Python demo 4: the fifth-order loop K/(s(s+1)(s+2)(s+3)(s+4)).
# python-control indents around s = 0 by itself; P = 0, Z = P + count.
import control as ct
s = ct.tf('s')
for K in (10, 40):
G5 = K / (s*(s+1)*(s+2)*(s+3)*(s+4))
print(K, ct.nyquist_response(G5).count)
The script prints 10 0 and 40 2. With $P=0$, $Z=P+\mathrm{count}$ gives $Z=0$ for $K=10$ and $Z=2$ for $K=40$: two clockwise encirclements and two unstable closed-loop poles. The curve crosses the negative real axis at $-K/30.09$, at $\omega=0.836$ rad/s, so the loop is stable for $0\lt K\lt 30.09$, as found in Lecture 24; the detour does not change this range.
A count is meaningful only when the curve stays away from $-1$. For $1/s^2$ and $1/(s^2+1)$, whose curves pass through $-1$, python-control 0.10.2 still returns a count of $2$ without a warning, although their closed-loop poles lie on the imaginary axis. Check the closed-loop poles, or the smallest value of $|1+L|$ on the contour, before relying on a count.
Perspective
The detours preserve a valid contour while retaining the information that would otherwise disappear at a singular frequency. Their mapped arcs are determined by the local pole order and coefficient, so they must be included in the complete winding calculation. After the contour is assembled, apply the usual root count and check separately for closed-loop roots on the imaginary axis.
The next lecture computes the axis crossings of a loop with two unstable poles, determines how changing the loop gain affects its stability, and uses the crossings of the negative real axis to define gain and phase margins.
Exercises
Try each exercise before opening its answer. All exercises use the contour of this page: the imaginary axis traversed upward, small detours of radius $\epsilon$ into the right half-plane around imaginary-axis poles, and the large clockwise semicircle of radius $R$, with $Z=P-N_{\mathrm{CCW}}$.
Exercise 1. For $L(s)=\dfrac{K}{s(s+a)}$ with $K\gt0$ and $a\gt0$, find the image of the indentation $s=\epsilon e^{j\theta}$, $-\pi/2\leq\theta\leq\pi/2$: its approximate radius, the direction in which it is traversed, and the angle it sweeps. Show that the positive-frequency branch approaches a vertical asymptote as $\omega\to0^+$. Then take $K=8$, $a=4$ and $\epsilon=0.01$, give the numbers, and use the complete contour to decide whether the unity-feedback loop is stable.
Answer
Here $L_0(s)=K/(s+a)$ and $L_0(0)=K/a$, so on the indentation
$$ L(\epsilon e^{j\theta})\approx\frac{K}{a\epsilon}e^{-j\theta}. $$As $\theta$ increases from $-90^\circ$ to $+90^\circ$, the image angle decreases from $+90^\circ$ to $-90^\circ$. The image is a clockwise half circle of radius $K/(a\epsilon)$ through the right half-plane, and its angle changes by $-180^\circ$ in the limit $\epsilon\to0^+$. On the imaginary axis,
$$ L(j\omega)=-\frac{K}{a^2+\omega^2}-j\frac{Ka}{\omega(a^2+\omega^2)}, $$so as $\omega\to0^+$ the imaginary part tends to $-\infty$ while the real part tends to $-K/a^2$.
For $K=8$ and $a=4$, the radius is $2/\epsilon=200$. The arc passes through $L(0.01)=199.50$ on the positive real axis, and its endpoints $L(\mp j0.01)\approx-0.5\pm j200$ join the two frequency branches. At $\epsilon=0.01$ the computed angle change is $-180.29^\circ$; the extra $0.29^\circ$ comes from the factor $1/(s+4)$ and vanishes as $\epsilon\to0^+$. The asymptote is $\Re L=-0.5$. For every $\omega\gt0$ the positive-frequency branch stays in the third quadrant with $-0.5\lt\Re L\lt0$, and the negative-frequency branch is its mirror image in the second quadrant. A ray from $-1$ to the left therefore meets no part of the image, so $N_{\mathrm{CCW}}=0$. The detour excludes the pole at the origin and the pole at $-4$ lies in the left half-plane, so $P=0$ and $Z=0$. The closed-loop polynomial $s^2+4s+8$ has roots $-2\pm j2$, which confirms stability.
Exercise 2. For $L(s)=\dfrac{K}{s(s+1)(s+2)}$ with $K\gt0$, find the frequency at which the positive-frequency branch crosses the negative real axis and the crossing point. Describe the image of the indentation at the origin. Give $N_{\mathrm{CCW}}$ and $Z$ for $K=3$ and $K=12$, and find the range of $K$ for which the closed loop is stable.
Answer
Since $j\omega(j\omega+1)(j\omega+2)=-3\omega^2+j\omega(2-\omega^2)$,
$$ L(j\omega)=\frac{K}{-3\omega^2+j\omega(2-\omega^2)}. $$The imaginary part of the denominator vanishes at $\omega=\sqrt{2}=1.414$ rad/s, where $L(j\sqrt{2})=-K/6$. This is the only crossing for $0\lt\omega\lt\infty$. Near the origin $L_0(0)=K/2$, so the indentation maps to a clockwise half circle of radius about $K/(2\epsilon)$ through the right half-plane. The positive-frequency branch starts far below the real axis near the vertical line $\Re L=-3K/4$, crosses the negative real axis at $-K/6$, and approaches the origin from above; the negative-frequency branch is its mirror image. The poles at $-1$ and $-2$ are in the left half-plane and the pole at the origin is excluded, so $P=0$.
For $K=3$ the crossing is at $-0.5$, to the right of $-1$, so $N_{\mathrm{CCW}}=0$ and $Z=0$. The roots of $s^3+3s^2+2s+3$ are $-2.672$ and $-0.164\pm j1.047$. For $K=12$ the crossing is at $-2$. Both frequency branches cross the real axis there moving upward, which is clockwise about $-1$, so $N_{\mathrm{CCW}}=-2$ and $Z=2$. The roots of $s^3+3s^2+2s+12$ are $-3.435$ and $0.217\pm j1.856$. The crossing reaches $-1$ when $K=6$; the roots are then $-3$ and $\pm j1.414$, at the crossing frequency. The closed loop is stable for $0\lt K\lt6$.
Exercise 3. Consider the double integrator with a zero, $L(s)=\dfrac{K(s+2)}{s^2}$ with $K\gt0$. (a) Map the indentation around the double pole at the origin and give the angle swept by its image. (b) Show that the frequency branches never reach the negative real axis, and determine $N_{\mathrm{CCW}}$ and stability for every $K\gt0$. (c) Can the pure double integrator $L(s)=K/s^2$ be stabilized by any real gain $K$?
Answer
(a) Here $L_0(s)=K(s+2)$ and $L_0(0)=2K$, so
$$ L(\epsilon e^{j\theta})\approx\frac{2K}{\epsilon^2}e^{-2j\theta}. $$As $\theta$ increases by $\pi$, the image angle decreases by $2\pi$. The image is a full clockwise turn of radius $2K/\epsilon^2$, which is $2\times10^4$ for $K=1$ and $\epsilon=0.01$. The exact image angle on the detour is $\angle(\epsilon e^{j\theta}+2)-2\theta$. It starts at $180^\circ-\tan^{-1}(\epsilon/2)$ and ends at $-180^\circ+\tan^{-1}(\epsilon/2)$, which is $179.71^\circ$ to $-179.71^\circ$ (a change of $-359.43^\circ$) at $\epsilon=0.01$. The turn therefore stops just short of the negative real axis at both ends.
(b) On the imaginary axis,
$$ L(j\omega)=-\frac{2K}{\omega^2}-j\frac{K}{\omega}, $$whose imaginary part is nonzero for every finite $\omega\ne0$. The positive-frequency branch lies below the negative real axis, the negative-frequency branch lies above it, and both approach the origin. Since the detour image also misses the negative real axis, a ray from $-1$ to the left meets no part of the image. Hence $N_{\mathrm{CCW}}=0$, $P=0$ and $Z=0$ for every $K\gt0$. The characteristic polynomial $s^2+Ks+2K$ has positive coefficients, which agrees with this count; for $K=1$ its roots are $-0.5\pm j1.323$.
(c) For $L(s)=K/s^2$, $L(j\omega)=-K/\omega^2$. With $K\gt0$ both branches lie on the negative real axis and pass through $-1$ at $\omega=\sqrt{K}$, so $1+L$ vanishes on the contour and the closed-loop roots are $\pm j\sqrt{K}$, a boundary case. With $K\lt0$ the branches lie on the positive real axis, and the detour image, a full clockwise turn of radius $|K|/\epsilon^2$, encircles $-1$ once. Then $N_{\mathrm{CCW}}=-1$ and $Z=1$; for $K=-1$ the closed-loop roots are $\pm1$. No real gain stabilizes $K/s^2$. The zero at $-2$ in part (b) adds phase lead, which moves the branches off the negative real axis.
Exercise 4. Let $L(s)=\dfrac{K}{(s+1)(s^2+1)}$, where $K$ may be positive or negative. (a) Expand $L$ about $s=j$ and $s=-j$ and describe the images of the two detours. (b) Find $N_{\mathrm{CCW}}$ and $Z$ for $K=1$, $K=-0.5$ and $K=-2$, and find the range of $K$ for which the closed loop is stable.
Answer
(a) With $s=j+\epsilon e^{j\theta}$, we have $s^2+1=(s-j)(s+j)\approx2j\epsilon e^{j\theta}$ and $s+1\approx1+j$, so
$$ L(s)\approx\frac{K}{2j(1+j)\epsilon}e^{-j\theta}=\frac{K(-1-j)}{4\epsilon}e^{-j\theta}. $$The coefficient $(-1-j)/4$ has magnitude $1/(2\sqrt{2})=0.354$ and angle $-135^\circ$. For $K\gt0$ the image is a half circle of radius $K/(2\sqrt{2}\epsilon)$ with angle $-135^\circ-\theta$. It turns clockwise from $-45^\circ$ to $-225^\circ$ and crosses the negative real axis at $\theta=45^\circ$. About $s=-j$ the coefficient is the conjugate, $K(-1+j)/4$, so the image angle is $135^\circ-\theta$. That arc turns clockwise from $225^\circ$ to $45^\circ$ and crosses the negative real axis at $\theta=-45^\circ$. Each detour image sweeps $-180^\circ$.
(b) On the imaginary axis,
$$ L(j\omega)=\frac{K(1-j\omega)}{(1-\omega^2)(1+\omega^2)}, $$which is real only at $\omega=0$, where $L(0)=K$. The poles at $\pm j$ are excluded by the detours and the pole at $-1$ is in the left half-plane, so $P=0$.
For $K=1$, both large arcs cross the negative real axis far to the left of $-1$, each turning clockwise, while the branches meet the real axis only at $+1$. Thus $N_{\mathrm{CCW}}=-2$ and $Z=2$; the roots of $s^3+s^2+s+2$ are $-1.353$ and $0.177\pm j1.203$. For $K=-0.5$ the whole image is reflected through the origin and the arcs cross the positive real axis. The branches meet the real axis only at $L(0)=-0.5$, to the right of $-1$, so $N_{\mathrm{CCW}}=0$ and $Z=0$, with roots $-0.648$ and $-0.176\pm j0.861$. For $K=-2$ the point $L(0)=-2$ lies to the left of $-1$, and the branch through it moves upward, which is clockwise about $-1$. Then $N_{\mathrm{CCW}}=-1$ and $Z=1$, with roots $0.544$ and $-0.772\pm j1.115$. The loop is stable exactly for $-1\lt K\lt0$; at $K=-1$ a closed-loop root lies at $s=0$. No positive gain stabilizes this loop, because for every $K\gt0$ the two large arcs pass clockwise to the left of $-1$ and give $N_{\mathrm{CCW}}=-2$. Without the detours the frequency branches would leave the curve open at $\omega=\pm1$, and this count could not be made.
Exercise 5. The detours on this page pass to the right of each imaginary-axis pole, so the pole lies outside the modified contour. (a) Why must the contour avoid the pole, and how is $P$ counted with this choice? Can the choice of side change $Z$? (b) Suppose the detour around the origin in Exercise 2 passed to the left instead, through the left half-plane. What are $P$ and the image of the detour, and what does the count give for $K=3$ and $K=12$?
Answer
(a) The argument principle relates the net turning of $1+L$ along a closed contour to the zeros and poles of $1+L$ inside it, and it requires $1+L$ to be finite and nonzero at every point of the contour. At an open-loop pole on the imaginary axis $L$ is infinite and its angle is undefined, so the contour must go around the pole. With the detour on the right, the boundary pole lies outside, and $P$ counts only the open-loop poles with $\Re s\gt0$, the same count used when no pole lies on the axis. Poles at the origin or at $\pm j$ are not added to $P$. The side cannot change $Z$. The closed-loop roots are the zeros of $1+L$, and $1+L$ is infinite at the open-loop pole, so for small $\epsilon$ no closed-loop root lies in the small half-disk between the two choices. Closed-loop roots on the imaginary axis away from the open-loop poles must still be checked separately; they appear as an image that passes through $-1$.
(b) On the left detour, $s=\epsilon e^{j\theta}$ with $\theta$ decreasing from $-\pi/2$ to $-3\pi/2$, passing through $-\epsilon$. The pole at the origin is now strictly inside the contour, so $P=1$. The image $(K/(2\epsilon))e^{-j\theta}$ turns counterclockwise by $+180^\circ$, from $+90^\circ$ through $180^\circ$ to $270^\circ$, and crosses the negative real axis far to the left of $-1$. For $K=3$ this arc gives the only encirclement, $N_{\mathrm{CCW}}=+1$, and $Z=1-1=0$. For $K=12$ the two branch crossings at $-2$ contribute $-2$ and the arc contributes $+1$, so $N_{\mathrm{CCW}}=-1$ and $Z=1-(-1)=2$. Both results agree with Exercise 2. The right-hand detour is the usual choice because it keeps $P$ equal to the number of open-loop poles strictly in the right half-plane.
The numbers and encirclement counts in these answers were checked with a short Python script that computes the closed-loop roots with NumPy and counts encirclements from the unwrapped angle of $1+L$ along an indented contour with $\epsilon=10^{-3}$ and $R=10^4$.
Exercises from the video
These exercises follow particular moments in the video lecture and use its notation, $\tilde G(s)$ for the open loop $L(s)$ and $\tilde G_0(s)$ for $L_0(s)$, and each one names the chapter and time to watch before you start it.
Video exercise 1. A pole sliding toward the origin. From the chapter “A pole sliding toward the origin”, at 3:27.
Take $\tilde G(s)=\dfrac{1}{s+a}$ with $a\gt 0$.
(a) Show that $\tilde G(j\omega)$ lies on the circle with center $1/(2a)$ and radius $1/(2a)$, and that the complete Nyquist plot is traversed clockwise. Give the diameter for $a=10$, $1$, $0.5$ and $0.01$, the values used in the video.
(b) The video says that at a fixed frequency the point settles down to $1/(j\omega)$ as $a\to0$. Show that $\bigl|\tilde G(j1)-1/(j1)\bigr|=a/\sqrt{1+a^2}$ and evaluate it for $a=0.1$ and $a=0.01$.
(c) Show that at the frequency $\omega=a$ the gap is $\bigl|\tilde G(ja)-1/(ja)\bigr|=1/(a\sqrt2)$, and evaluate it for $a=0.1$ and $a=0.01$. In one or two sentences, explain what this says about closing the Nyquist plot of $1/s$ from its frequency response alone.
(d) Find the closed-loop pole for each $a$. What does it approach as $a\to0$?
Video exercise 2. The integrator assembled piece by piece. From the chapter “The integrator, piece by piece”, at 8:07.
As in the video, the indented contour has four pieces: $\Gamma_1$ runs up the imaginary axis from $j\epsilon$ to $jR$, $\Gamma_2$ is the large clockwise half circle, $\Gamma_3$ runs up the axis from $-jR$ to $-j\epsilon$, and $\Gamma_4$ is the small detour $s=\epsilon e^{j\theta}$, with $\theta$ from $-\pi/2$ to $\pi/2$. Take $\tilde G(s)=1/s$ with the values drawn in the video, $\epsilon=0.5$ and $R=4$.
(a) For each of the four pieces $\Gamma_1$ to $\Gamma_4$, write $\tilde G(s)$ along the piece, give the images of its start and end points, and give the change in the angle of $\tilde G$ along it.
(b) Add the four angle changes. Where does $-1$ lie relative to the closed image? Give $N_{\mathrm{CCW}}$, $P$ and $Z$.
(c) Derive $T(s)=\tilde G(s)/(1+\tilde G(s))$ and use it to confirm $Z$.
Video exercise 3 (Python). Moving the detour of the fifth-order loop to the left. From the chapter “Checking it in Python (python-control and numpy)”, at 9:53.
The video uses indent_direction='left' on the motor loop and notes that moving the detour changes $P$ and $N_{\mathrm{CCW}}$ together. Apply the same option to the fifth-order loop $\tilde G(s)=K/(s(s+1)(s+2)(s+3)(s+4))$ from the last chapter of the video:
import control as ct
s = ct.tf('s')
for K in (10, 40):
G5 = K / (s*(s+1)*(s+2)*(s+3)*(s+4))
right = ct.nyquist_response(G5).count
left = ct.nyquist_response(G5, indent_direction='left').count
print(K, right, left)
Before running the code, state $P$ for each detour direction and predict the two left counts from the right counts given in the video, $0$ for $K=10$ and $2$ for $K=40$. Then run it and compute $Z$ from each column.
Video exercise 4. The detour around the pole at $+j$. From the chapter “Poles at plus and minus j”, at 14:29.
Take $\tilde G(s)=\dfrac{1}{s^2+1}$, with poles at $\pm j$. The video expands the loop near $-j$ and only states the result near $+j$.
(a) Put $s=j+\epsilon e^{j\theta}$, expand $s^2+1$, and keep the leading term to show that near $+j$
$$ \tilde G(s)\approx\frac{c}{\epsilon}\,e^{-j\theta},\qquad c=-\frac{j}{2}. $$(b) As $\theta$ goes from $-\pi/2$ to $\pi/2$, give the radius of the image arc, its start and end angles, the direction in which it turns, and the point it passes at $\theta=0$. Evaluate the radius for $\epsilon=0.01$.
(c) Find the frequency at which the frequency branches pass through $-1$, and find the closed-loop poles. Why does $Z=P-N_{\mathrm{CCW}}$ give no answer for this loop?
Video exercise 5. The detour of the fifth-order loop. From the chapter “The indented Nyquist contour, and what comes next”, at 16:09.
The video settles the loose end left by the Lecture 24 video, the pole at $s=0$ of $\tilde G(s)=\dfrac{K}{s(s+1)(s+2)(s+3)(s+4)}$.
(a) Write $\tilde G(s)=\tilde G_0(s)/s$ and find $c=\tilde G_0(0)$. Find the radius of the detour image for $\epsilon=10^{-3}$ with $K=10$ and with $K=40$, and compare the first value with the “about four hundred seventeen” stated in the video.
(b) The detour image crosses the positive real axis at $\tilde G(\epsilon)$. Compute it for $K=10$ and $\epsilon=10^{-3}$, and explain why it is slightly smaller than $c/\epsilon$.
(c) The ends of the detour image have real part $-0.868$ for $K=10$ and $-3.47$ for $K=40$, to the left of $-1$ in the second case. Explain why the detour image still never meets the ray to the left of $-1$. Then use the crossing $-K/30.09$ of the negative real axis, found in Lecture 24, to give $N_{\mathrm{CCW}}$ and $Z$ for $K=10$ and $K=40$.
References
Norman S. Nise, Control Systems Engineering, 6th ed., Wiley, 2011.
- §§10.4–10.5: Nyquist diagrams, contour detours, and stability.