JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Feedback & Stability

Almost every precise analog circuit you will ever build is held together by negative feedback — the trick that turns sloppy, temperature-drifting, wildly variable transistors into amplifiers you can actually trust. But feedback charges a price: the same loop that buys you precision can start to ring, or even oscillate, if you are not careful. This is the math peak of the track. We will reason out loop gain, the 1/beta law, poles and phase margin, frequency compensation, and slew rate — always the intuition first, then the number.

Why feedback rules analog

Here is the uncomfortable truth about analog parts: they are terrible. A raw common-source stage might have a gain of 40 one day and 80 the next, drifting with temperature, supply voltage, and the random lottery of how the silicon came out of the fab. The intrinsic gain of a single transistor, gm*ro, is large but utterly imprecise. If you tried to build a precision amplifier by just picking a transistor with 'about the right gain,' you would fail — the gain you actually got would wander by a factor of two.

Negative feedback is the escape hatch. The idea, in one sentence: measure your own output, compare it to what you wanted, and feed back the error to correct yourself. Crank a transistor's raw gain up as high as it will go — sloppy, drifty, whatever — then wrap a loop around it that constantly says 'you're a little high, back off' or 'you're a little low, push harder.' The astonishing payoff is that the closed-loop behavior stops depending on the lousy transistor and starts depending almost entirely on a ratio of two resistors (or capacitors) — components you *can* match to a fraction of a percent on-chip.

Think of it like steering a car. The engine (raw gain) is powerful but crude — you would never set the throttle to an exact position and trust the car to hold a lane. Instead you *watch the lane* and nudge the wheel continuously. Your eyes are the feedback. The car's precision comes not from a perfect engine but from the correction loop wrapped around an imperfect one. Negative feedback does exactly this for voltage and current.

Negative feedback & loop gain

Let's name the pieces. Call the amplifier's raw, open-loop gain A (huge — maybe 10,000 or 100,000). A fraction beta of the output is fed back and subtracted from the input. The product **T = A*beta is the single most important number in the whole loop; we call it the loop gain**. It is, intuitively, *how hard the loop corrects itself* — how much louder the 'you're off, fix it' signal is than the error that caused it.

A_closed = A / (1 + A*beta)
; when loop gain T = A*beta >> 1:
A_closed  ~=  1 / beta
The closed-loop gain. When loop gain A*beta is large, the messy A cancels out of the top and bottom, and the closed-loop gain collapses to 1/beta — set purely by the feedback network you control.

Stare at that result, because it is the whole point. When **T = A*beta is large, the closed-loop gain becomes simply 1/beta. The capricious A has vanished. If beta is a divider made of two matched resistors, your amplifier's gain is now a resistor ratio — stable to a fraction of a percent, immune to A doubling or halving. We didn't make A good; we made the circuit not care** about A.

Loop gain also tells you how *good* the approximation is. The closed-loop gain isn't exactly 1/beta — it falls short by a relative error of about 1/T. So a loop gain of 1,000 (60 dB) gives you roughly 0.1% gain accuracy; a loop gain of 100 gives you about 1%. More loop gain means more precision, more linearity, and more rejection of disturbances. This is why analog designers are forever hungry for gain: every decibel of loop gain is precision in the bank.

The price: stability

If feedback were free, every amplifier would have infinite loop gain and we'd all go home. The catch is time. The phrase 'feed the output back to the input' quietly assumes the output reacts *instantly*. It doesn't. Every stage has capacitance that takes time to charge, so the fed-back signal always arrives a little late — delayed, and with its phase shifted.

A small delay is harmless. But here is the nightmare scenario. Negative feedback works because the fed-back signal arrives 180 degrees out of phase — it subtracts, it opposes, it corrects. Now suppose that at some frequency the circuit's own delays pile up an *extra* 180 degrees of phase shift. Add that to the intentional 180, and you get 360 degrees — which is the same as zero. Your negative feedback has quietly become positive feedback. The 'correction' now reinforces the error instead of opposing it.

So the price of feedback is the constant threat of instability. The more loop gain you pile on for precision, and the more stages you cascade for that gain, the more phase shift accumulates — and the closer you drift to that 360-degree cliff. The art of compensation, coming up, is the art of staying back from the edge while keeping as much loop gain as you can. Precision and stability pull in opposite directions; design is the negotiated truce between them.

Poles & phase margin

To manage stability we need to make 'how much phase shift, at what frequency' concrete. Each RC time constant in the signal path creates a pole: a frequency above which gain rolls off at 20 dB per decade and the signal picks up phase lag, asymptotically 90 degrees per pole. One pole can only ever cost you 90 degrees — safe on its own. The trouble starts when a *second* pole's phase lag piles on top of the first, marching the total toward the fatal 180 degrees of extra shift.

The clean way to measure your safety cushion is [[phase-margin|phase margin]]. First find the frequency where the loop gain |T| has dropped to exactly 1 (0 dB) — this is the crossover or unity-gain frequency, the last frequency at which the loop can still sustain a signal. Now read off how much phase shift the loop has at that frequency. Phase margin is how many degrees of phase you have left before hitting 180:

phase_margin = 180 deg + angle(T)   evaluated at the frequency where |T| = 1

; PM >= 60 deg  ->  smooth, well-damped, no ringing   (the design target)
; PM ~  45 deg  ->  acceptable, mild overshoot/ringing
; PM ->  0  deg  ->  on the verge of oscillation
Phase margin is the leftover phase at unity loop gain — the cushion before the loop's feedback turns positive. Most amplifiers target 60 degrees; below ~45 the step response rings, and at 0 it oscillates.

Intuition for the number: phase margin is the damping of your feedback loop, exactly like the shock absorbers on a car. A big phase margin (60 degrees and up) is well-damped — hit it with a step and the output rises cleanly to its target. A skimpy phase margin (under 45) is underdamped — the output overshoots and rings, bouncing past the target a few times before settling, like a car with worn-out shocks hitting a bump. Zero phase margin means no damping at all: it rings forever. That's an oscillator.

Frequency compensation

So you've measured your loop and the phase margin is a scary 20 degrees — it rings, or oscillates outright. The cure is [[frequency-compensation|frequency compensation]]: deliberately reshaping the loop's gain-versus-frequency curve so that |T| crosses through 1 *while you still have comfortable phase left.* You are not adding correctness; you are buying back stability, usually by sacrificing some bandwidth.

The workhorse technique is dominant-pole compensation. The trick: pick one pole and push it deliberately *low* in frequency — so low that the gain has already rolled all the way down to 1 because of that single pole, before any of the other, faster poles get a chance to add their phase lag. If only one pole is active at crossover, the worst-case phase lag is just 90 degrees, leaving a luxurious ~90 degrees of phase margin. You've traded bandwidth (the loop is now slower) for rock-solid stability.

On-chip, the elegant way to create that dominant pole is the Miller effect. Place a small compensation capacitor Cc across a high-gain inverting stage, and the stage's own gain *multiplies* the cap's apparent size by roughly (1 + gain) as seen from the input. A tiny 2 pF cap can act like hundreds of pF, dragging the dominant pole down dramatically without burning chip area. As a bonus, Miller compensation splits the poles — it pulls the dominant pole lower *and* shoves the next pole higher, widening the safe gap between them. This is why nearly every two-stage op-amp you'll ever meet has a Miller cap tucked inside.

.ac dec 100 1 1G      ; sweep frequency, plot loop gain & phase
; read GBW (where |T| crosses 0 dB) and the phase there:
GBW ~= gm1 / (2*pi*Cc)   ; bigger Cc  ->  lower GBW, more phase margin
An .ac sweep is how you actually measure a loop's stability in SPICE: find the 0 dB crossover, read the phase margin there. For a Miller-compensated op-amp the [[gain-bandwidth-product|gain-bandwidth product]] is set by the input gm over the comp cap — enlarge Cc to trade bandwidth for margin.

Slew rate: the large-signal limit

Everything so far — poles, phase margin, GBW — lives in the world of small signals, where we assume the amplifier behaves linearly and the wiggle is tiny. But ask an op-amp to make a *big* fast jump and a completely different, brutal limit kicks in: [[slew-rate|slew rate]], the maximum speed at which the output voltage can change, measured in volts per microsecond.

The cause is delightfully simple and physical. To move the output, the amplifier must charge or discharge that compensation capacitor Cc, and it can only do so with the finite tail current its input stage can deliver. When the input step is large, the input differential pair dumps all of its tail current into Cc — it's maxed out, fully one-sided, no longer in its gentle linear region. The output then ramps at a constant rate set by 'current available divided by capacitance':

slew_rate = I_tail / Cc          ; volts per second, large-signal limit

; small-signal speed (different beast):
GBW = gm / (2*pi*Cc),   gm = 2*I_d / V_ov
; -> SR = (I_tail / Cc) is set by CURRENT;
;    GBW is set by gm. You can have great GBW and lousy slew rate.
Slew rate is I/C — a large-signal limit set by how much current can charge the comp cap. It is a different limit from small-signal bandwidth (GBW), and the two do not track each other.

Here's the mental model that keeps people out of trouble: bandwidth is how fast you can react to a whisper; slew rate is how fast you can react to a shout. A megaphone might faithfully reproduce a quiet conversation (good small-signal bandwidth) yet completely garble a sudden loud shout because it can't move air fast enough (slew-rate limited). During slewing, the amplifier is *not* a linear system at all — feedback effectively goes open-loop until the output catches up, and the clean exponential settling you designed for turns into an ugly straight-line ramp.