C651 of 57
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C6 · Lesson 51 · Feedback lab

Loop gain, phase margin and peaking in NumPy

Stability analysis comes down to one function, the loop gain L(f)=A(f)β. Where its magnitude crosses one, its phase tells you how close the loop is to oscillating, and the closed-loop response's peak shows the same thing from the outside. In this lab you'll compute the loop gain of a multi-pole amplifier, find its crossover and phase margin by bisection, and measure the closed-loop peaking, then use them to see how much margin it takes to get a flat response.

  • The closed-loop response of an amplifier with A0=105, a dominant pole at 10 Hz and a second pole at f2, with feedback factor β.
  • With β = 1 (a follower) and f2 = 1 MHz the response peaks about 1.2 dB before rolling off: 52° of margin.
  • Raise f2 or lower β: the peak disappears. Lower f2: it grows into a sharp resonance, a loop about to ring.

Predict

A follower's loop gain has a dominant pole and a second pole at the follower's GBW. How much does its closed-loop response peak?

Name it

The loop gain

For an amplifier with DC gain A0 and poles pk (in hertz), with feedback β:

L(f)=A0β∏k11+jf/pk

In NumPy, start with A0β as a complex array the length of f and divide by each factor.

Crossover and phase margin

|L| falls monotonically, so bisection finds the crossover fc where |L|=1; search on log10⁡f so the steps are even across decades. The phase margin is

PM=180°+∠L(fc)=180°−∑karctan⁡fcpk

computed from the arctangents, since np.angle wraps to ±180° and can't tell 190° of lag from −170°.

Closed-loop peaking

The closed-loop gain is G=A1+Aβ=L/β1+L. Sample it densely on a logarithmic grid and compare its largest magnitude with its DC value A01+A0β. For two poles, about 65° of margin gives a maximally flat response, 45° gives 2.3 dB of peaking, and 30° about 6 dB.

Worked example

A follower (A0=105, poles at 10 Hz and 1 MHz). Find its crossover and phase margin.

Show the solution
  1. Crossover. Bisection gives fc = 786 kHz.
  2. Phase from each pole. arctan⁡(78,600)≈90°arctan⁡(0.786)=38.2° so PM = 51.8°.
  3. Compare the quick estimate. With fc at GBW (1 MHz) it gives 45°; the exact crossover is lower, so the margin is better.

Answer the loop crosses over at 786 kHz with a phase margin of 51.8°.

Worked example

The same amplifier with β = 0.1 (a gain of 10). Find its margin.

Show the solution
  1. Crossover. The loop gain is ten times smaller, so it crosses one at 99.5 kHz, a decade below the second pole.
  2. Phase margin. PM = 84.3°, and the closed-loop response doesn't peak at all.
  3. The pattern. Higher closed-loop gain means less loop gain and more margin.

Answer the phase margin is 84.3°, with crossover at 99.5 kHz.

Check

A single-pole amplifier (A0 = 10000, pole at 100 Hz) has β = 0.01. What is |L| at 50 kHz?

Check

A loop crosses over at 0.5 MHz, far above its dominant pole, with further poles at 1 MHz and 40 MHz. What is its phase margin?

Check

Write loop_gain(f, A0, beta, poles) (complex L at the frequencies f) and phase_margin(A0, beta, poles) returning (fc, pm): the crossover by bisection on log10⁡f between 1 Hz and 10¹² Hz, and the margin from the arctangents.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write peaking_db(A0, beta, poles): the closed-loop gain's maximum over np.logspace(0, 12, 200001) Hz, in dB relative to its DC value A0/(1+A0β).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why does a smaller phase margin show up as peaking in the closed-loop response?

Practice

Keep practicing

5 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.