Analog design

phase margin

Picture pushing a child on a swing. If you push at exactly the right moment each time — perfectly in sync with the swing's natural rhythm — even tiny pushes pile up and the swing climbs higher and higher. A feedback amplifier has the same danger. It works by feeding a fraction of the output back to the input to cancel error, which only helps if that returning signal arrives out of step with the input (negative feedback). But every amplifier delays its signal a little, and that delay grows with frequency. If at some frequency the delay flips the feedback into being perfectly in sync (a phase shift of 180 degrees), and the loop is still strong enough to send a signal all the way around without shrinking, the circuit pushes itself — it oscillates instead of settling. Phase margin is simply how much breathing room you have before that happens.

More precisely: find the frequency where the loop gain has dropped to exactly 1 (0 dB) — the point where a signal makes it around the loop neither growing nor shrinking. At that frequency, measure how much phase shift the loop has accumulated. Phase margin is the gap between that phase and the fatal 180 degrees. So if the loop has rotated the signal 130 degrees at unity gain, you have 50 degrees of margin. Zero margin means it oscillates. A small positive margin technically won't oscillate, but it rings badly and overshoots, like a door that slams and bounces before closing. The practical rule of thumb is to keep at least 45 to 60 degrees: 45 degrees is usually the minimum you'll accept, and around 60 degrees gives a clean, well-damped step response with little ringing.

This is why analog designers obsess over compensation. An op-amp often has two or more poles, each adding up to 90 degrees of phase lag, so two poles close together can easily eat your whole budget. The fix — dominant-pole or Miller compensation — deliberately pushes one pole very low in frequency so the gain rolls off to unity long before the second pole's phase lag arrives, buying back margin at the cost of bandwidth. Phase margin, then, is the number that captures the eternal analog trade: stability versus speed.

.ac dec 100 1 1g  ; plot loop-gain magnitude and phase, read phase where |gain| = 0 dB

An AC sweep gives the Bode plot: find the frequency where the loop gain crosses 0 dB, then phase margin = 180 degrees minus the phase lag there.

Phase margin is read at the unity-gain (0 dB) frequency, while gain margin is read at the 180-degree frequency — they are two complementary views of the same Bode plot, and a robust design wants healthy amounts of both.

Also called
PM相位余量相位餘量