Stability and Frequency Compensation
You wire an amplifier with three gain stages, close a feedback loop for a gain of 10, and the output shows a clean 3 kHz sine with no input at all. Negative feedback has turned positive. Negative Feedback promised precision for loop gain; this lesson collects the bill. Each pole in the loop adds up to of phase lag, and once the loop's phase reaches while its gain is still at least 1, the signal that returns adds to the input. We will read stability off the loop-gain Bode plot with phase and gain margins, see why three poles are dangerous and two poles merely ring, and fix both with dominant-pole and Miller (pole-splitting) compensation, the technique inside almost every general-purpose op-amp.
Margins on the loop-gain Bode plot
Write the loop gain . The closed-loop gain blows up where : magnitude 1 and phase . Two numbers measure how far the loop stays from that point (Decibels and Bode Plots):
- Phase margin at the gain crossover , where .
- Gain margin at the phase crossover , where .
For a loop whose gain falls steadily, positive PM and GM mean a stable closed loop. Margins also predict the quality of the response: for a loop that behaves like an integrator and one more pole (a second-order closed loop), means a step overshoot of about 23 %, under 10 %, and () none; other loops follow these figures only roughly. Designers aim for 45 to 60°.
Why poles matter: a real pole lags at its own frequency and a decade above. One pole can never reach ; two poles reach it only at infinite frequency, where is long below 1, so a two-pole loop is always stable but may ring with a tiny PM; three poles pass at a finite frequency, and if there the loop oscillates. Delays, extra transistor poles and capacitive loads all count as more poles. The same analysis is the core of Control Systems & Automation.
Explore: three poles in a loop
The lab plots a loop gain with poles at , and , and judges the closed loop by Routh–Hurwitz.
With (100) the lab shows a gain crossover at , PM and GM : stable on paper, a ringing oscillator in practice; raise by 2 dB and it becomes unstable. Lower to 20 dB and the margins become and , but then the loop gain, and every benefit of feedback, is ten times smaller. The third option is to change the poles.
Dominant-pole compensation
Move the lowest pole down (in an op-amp, by adding capacitance at a high-impedance node) until falls to 1 before the second pole has added much phase. With fixed at 100, crossover happens near :
| gain crossover | PM | GM | |
|---|---|---|---|
| (uncompensated) | |||
These are the lab's readouts with the f1 slider at each value. The cost is plain: the loop now has gain only up to about , so the closed loop is slower. General-purpose op-amps are compensated this way so that they are stable with any resistive feedback down to (a follower), which is the worst case because it has the most loop gain. That compensation is what makes their open-loop response look like a single pole at about 10 Hz with a constant gain–bandwidth product.
In Python: margins and overshoot with python-control
ct.margin returns the gain margin (as a ratio), the phase margin and both crossover frequencies (rad/s). The closed-loop step response shows what each margin looks like in time.
import numpy as np
import control as ct
def loop(T0, f1, f2=1e3, f3=1e4):
s = ct.tf('s')
w = [2 * np.pi * f for f in (f1, f2, f3)]
return T0 / ((1 + s / w[0]) * (1 + s / w[1]) * (1 + s / w[2]))
print(" T0 f1 f_gc (Hz) PM (deg) GM (dB) overshoot")
for T0, f1 in ((100, 100), (10, 100), (100, 10), (100, 1)):
L = loop(T0, f1)
gm, pm, wpc, wgc = ct.margin(L)
t = np.linspace(0, 0.05, 20001)
_, y = ct.step_response(ct.feedback(L, 1), t)
yf = T0 / (1 + T0)
os_ = max(100 * (y.max() - yf) / yf, 0.0)
print(f"{T0:5.0f} {f1:6.0f} {wgc/2/np.pi:11.1f} {pm:9.1f} {20*np.log10(gm):8.1f} {os_:8.1f} %")
# Miller (pole-splitting) compensation of a two-stage op-amp
gm1, R1, C1, gm2, R2, C2, Cc = 0.2e-3, 1e6, 1e-12, 2e-3, 100e3, 20e-12, 30e-12
p1 = 1 / (2 * np.pi * gm2 * R2 * R1 * Cc)
p2 = gm2 * Cc / (2 * np.pi * (C1 * C2 + Cc * (C1 + C2)))
print(f"Miller: p1 = {p1:.1f} Hz, GBW = gm1/(2 pi Cc) = {gm1/(2*np.pi*Cc)/1e6:.2f} MHz, "
f"p2 = {p2/1e6:.1f} MHz, RHP zero = {gm2/(2*np.pi*Cc)/1e6:.1f} MHz") T0 f1 f_gc (Hz) PM (deg) GM (dB) overshoot
100 100 3013.7 3.5 1.7 88.2 %
10 100 779.8 54.9 21.7 18.3 %
100 10 784.4 48.1 20.9 20.4 %
100 1 99.5 84.3 40.8 0.0 %
Miller: p1 = 26.5 Hz, GBW = gm1/(2 pi Cc) = 1.06 MHz, p2 = 14.7 MHz, RHP zero = 10.6 MHz
The margins match the lab's readouts. The step responses make them concrete: of phase margin gives 88 % overshoot and a long ringing tail; about gives roughly 20 %; gives none.
Miller compensation: pole splitting
A two-stage op-amp has two high-impedance nodes, the first stage's output n1 and the output, each with a pole. Without compensation they sit close together, here at and , under a DC gain of : a two-pole loop with almost no phase margin. A capacitor across the inverting second stage does two things at once (High-Frequency Response and the Miller Effect):
The Miller effect multiplies by the second stage's gain and drags the first pole far down; at high frequency shorts the second stage's input to its output, making it a low-resistance diode-like load, which pushes the second pole far up. The poles split. The gain–bandwidth product is set by one transconductance and one capacitor, which is why datasheets quote GBW so confidently. A side effect is a right-half-plane zero at that adds phase lag; a small resistor in series with (a nulling resistor) moves it out of the way.
Worked example
Given: the two-stage model above, , used as a unity-gain follower ().
Find: the dominant pole, GBW, second pole, the RHP zero and the phase margin.
Solve:
Check: , the same GBW computed two ways. The zero costs more phase than the second pole: a reason to add the nulling resistor in a faster design.
Cross-check with SPICE
The open-loop response of the two-stage model, first with , then with practically removed. cph gives continuous phase, so the phase margin is plus the phase at the unity-gain frequency.
cat > miller.cir <<'EOF'
* Two-stage op-amp model, open loop: pole splitting by a Miller capacitor
* stage 1: gm1 = 0.2 mA/V into R1 = 1 MEG, C1 = 1 pF; stage 2 (inverting): gm2 = 2 mA/V into R2 = 100k, C2 = 20 pF
Vin in 0 DC 0 AC 1
G1 0 n1 in 0 0.2m
R1 n1 0 1meg
C1 n1 0 1p
G2 out 0 n1 0 2m
R2 out 0 100k
C2 out 0 20p
Cc n1 out 30p
* unity inverter so that the open-loop gain is positive at DC
E3 o 0 out 0 -1
.control
ac dec 100 1 1g
let ph = 180/pi*cph(v(o))
meas ac a0 find vdb(o) at=1
meas ac f_unity when vdb(o)=0 fall=1
meas ac ph_unity find ph when vdb(o)=0 fall=1
alter Cc 1f
ac dec 100 1 1g
let ph = 180/pi*cph(v(o))
meas ac f_unity_unc when vdb(o)=0 fall=1
meas ac ph_unity_unc find ph when vdb(o)=0 fall=1
.endc
.end
EOF
ngspice -b miller.cir 2>&1 | grep -E '^[a-z0-9_]+ +='a0 = 9.203496e+01
f_unity = 1.057297e+06
ph_unity = -9.978108e+01
f_unity_unc = 2.249666e+07
ph_unity_unc = -1.793559e+02
Compensated: of DC gain, unity gain at with the phase at , a phase margin of , exactly the hand estimate. Uncompensated: unity gain at with a phase margin of : as a follower it would ring for thousands of cycles, and any extra pole (a capacitive load, a probe) would make it oscillate.
Guided lab: provoke and cure ringing
Hand calculation. A follower built from a unity-gain-stable op-amp has PM of about 60 to 80°. A capacitive load on its output resistance adds a pole at ; with and that is , well below a 1 MHz crossover: PM collapses.
Simulation. The lab with a third pole lowered towards the crossover; Python's overshoot column.
What you would measure. Build a voltage follower with a general-purpose op-amp on ; drive it with a , 10 kHz square wave (small, to stay clear of slew-rate limiting). With no load the output edges show little or no overshoot. Add , then , directly at the output: expect overshoot growing to tens of percent with ringing at a few hundred kHz, or sustained oscillation, depending on the part. Then put to in series between the output and (an isolation resistor, which adds a zero that restores phase) and the ringing should largely disappear. Read overshoot with the scope cursors; at 10 to 20 % overshoot the reading is good to a couple of percentage points.
Hazards and safe setup. with limits. An oscillating op-amp can run hot and disturb other circuits on the bench; switch off as soon as you see sustained oscillation.
Pitfalls
- Testing stability only at the design gain. An op-amp compensated for gains of 5 or more ("decompensated") oscillates as a follower.
- Capacitive loads and long cables add a pole at the output; isolate them with a series resistor.
- Feedback capacitance at the inverting input (input capacitance with a large ) adds a pole in ; a small capacitor across compensates it.
- Reading margins from the closed-loop response. Margins belong to the loop gain , not to alone or to .
Practice
- A loop has and poles at , and . Estimate the gain crossover and whether the PM is comfortable.
- Where must the dominant pole go so that the crossover is at with the same ?
- In the Miller example, which would give a GBW of , and what happens to the phase margin?
Answer
- On the single-pole asymptote crossover would be at , beyond the second pole, so the second and third poles already lag and there: the loop is unstable or very nearly so. Not comfortable.
- ; the other poles then lag , PM about .
- ; falls to about and the zero to , so PM : still acceptable, but the margin has shrunk.
Test yourself
Phase margin is measured…
- where the phase of the loop gain is
- at the frequency where
- at DC
- where the closed-loop gain is
Why can a loop with two real poles never oscillate, while one with three can?
- Two poles have more gain
- Two poles reach only at infinite frequency, where ; three reach it at a finite frequency
- Three poles cancel each other
- Routh–Hurwitz does not apply to two poles
In Miller compensation the gain–bandwidth product is approximately…
Dominant-pole compensation buys stability at the cost of…
- DC gain
- bandwidth (loop gain at high frequency)
- input impedance
- supply current
An op-amp follower rings when driving . A common fix is…
- a larger load capacitor
- a small resistor in series between the output and the capacitor
- removing the feedback
- a higher supply voltage