Feedback, and the margin

The loop that never crosses

Every loop this field draws carries two margins, and one of them is not always a number. Take the third pole out of the standard loop and its crossover moves by 2.45 parts per million and its phase margin by 0.164 degrees — the third pole's own arctangent there, to five decimal places — while its gain margin goes from 46.06 decibels to no number at all. The phase reaches −180° only where the magnitude has already reached −62 decibels, and the two instruments that are supposed to notice report 3.19 × 10⁻⁶ either way.

Assumes: What is left at crossover · Two measurements of one margin · The matrix that is ill, and the answer that is not

What is left at crossover quotes two numbers about every loop this field has drawn: how much phase is left where the gain has fallen to unity, and how far below unity the gain has fallen where the phase reaches −180°. They are read off the same sweep, they are printed side by side, and they look like the same kind of quantity.

Only the first of them always exists. The second is a distance to a crossing, and a loop is not obliged to have one. The machinery that measures it says so — asked for a gain margin on a loop whose phase never reaches −180°, it returns a sentence instead of a number — and until now nothing in this collection has ever taken that branch, because every loop drawn here was built with three poles on purpose so that it could not.

That decision is recorded in the construction itself. A two-pole loop, the reasoning went, has an infinite gain margin and a locus that never crosses the negative real axis, which makes both of those figures a picture of an idealisation rather than of an amplifier; every real device has a third corner somewhere, so put one in and let the criterion have something to decide. The reasoning is sound. What it produced is a field in which one of the two headline numbers has never once been allowed to come out empty, and a category that is described in a comment and measured nowhere.

Loop gain of a two-pole amplifier closed for a gain of 100. Unity loop gain at 5.73 kHz, where 35.0° of phase remains before −180°. The phase never reaches −180° at any frequency, so there is no gain margin to quote: 2 poles contribute at most 180° and the last of it arrives only at infinity.
Fig. 1 The same loop with the third section taken out. Unity loop gain at 5.73 kHz with 35.0° of phase in hand, and a phase curve that flattens onto −180° without ever arriving. There is no second edge mark on the magnitude plot because there is no frequency to put it at.

What is being solved

The loop gain is obtained the way it is obtained on a bench rather than written down as an expression. The feedback network is cut at one point, a source drives one side of the cut, and what comes back to the other side is measured — so the quantity plotted is a return ratio taken from a solved netlist, and no symbol for βA appears anywhere in it. The closed loop is the identical forward path with the divider joined back on, element for element, which is what makes any comparison between the two a comparison of one circuit.

The forward path is a gain block of 10⁵ followed by three resistor–capacitor sections at 10 Hz, 4 kHz and 2 MHz, each with a unity buffer behind it so that one section does not load the next. The divider is two resistors asking for a closed-loop gain of 100.

Removing a pole means removing one section and its buffer and nothing else. The gain block, the two remaining sections, the divider and the cut are the same elements with the same values and the same names; a unity buffer carries the second section’s node to the output so that the node the sweep reads is called the same thing either way. Two netlists, one pole apart.

Loop gain of a three-pole amplifier closed for a gain of 100. Unity loop gain at 5.73 kHz, where 34.9° of phase remains before −180°. The phase reaches −180° at 89.6 kHz, where the loop gain is 46.1 dB below unity.
Fig. 2 The three-pole loop this field has drawn since its first essay, for comparison. Unity loop gain at 5.73 kHz with 34.9° of phase left, and a phase that passes −180° at 89.6 kHz where the loop gain is 46.1 dB below unity. The two figures differ in one element.

The reproduction, which comes before the departure

A comparison between two circuits is worth nothing until it is established that they are the same circuit where they ought to be. The place to establish it is the crossover, because that is where the number this field trusts most is measured, and because a pole two and a half decades above the crossover has almost no business being there.

It has almost none, and the residue is measurable. The two-pole loop crosses unity at 5726.43836 Hz and the three-pole loop at 5726.42432 — apart by 2.45 parts per million. The phase margins are 35.034911° and 34.870927°, apart by 0.163983°.

That shortfall is not a discrepancy to be tolerated. It is a prediction that can be checked, because a single lag section contributes exactly arctan(f/f3)\arctan(f/f_3) of phase at frequency ff, and at the crossover that is arctan(5726.42/2×106)\arctan(5726.42/2\times10^{6}), which is 0.164050°. The measured shortfall and the arctangent agree to four parts in ten thousand at this pole position, and to seven figures once the pole is far enough out that nothing else is left. One of those numbers comes from bisecting a solved netlist twice over and differencing the results; the other is one arctangent of a ratio of two frequencies. They share the crossover frequency and nothing else.

So the two loops are the same loop where they should be, and the instrument reading them is calibrated. Whatever they now disagree about is the third pole and not the arithmetic — the same move the assumption that is a geometry makes before it is allowed to quote a disagreement, and the same one one step computed twice insists on for a transient.

The departure, which is not a small number

The gain margin of the three-pole loop is 46.06 decibels. The gain margin of the two-pole loop does not exist. That is not a large disagreement between two numbers; it is a disagreement about whether there is a number.

The way to see that this is a property of the model rather than an accident of one pole position is to move the pole rather than remove it, and watch what each margin does on the way out.

One margin has a limit as the third pole leaves and the other does not. computed by solving, not by drawing. The same loop with its third pole walked from 200 kHz to 100 GHz. The gain margin climbs from 26.2 dB to 140.0 and does not stop — 20.000 decibels for every decade the pole moves, for as long as it is moved. The lower panel is how far the phase margin still is from the two-pole loop's 35.0349°, and it falls a decade per decade: 1.633° at 200 kHz, 0.1640° at the 2.00 MHz this field's standard loop uses, and 3.28e-6° at 100 GHz. The faint line under it is arctan(fc/f3) in degrees, which the measured shortfall equals to seven figures once the pole is far out — one quantity from two bisections on a solved netlist, the other from a single lag term.
Fig. 3 The same loop with its third pole walked from 200 kHz to 100 GHz. The gain margin rises at 20.00 decibels a decade — 26.2 dB at the bottom, 140.0 at the top — and shows no sign of a limit, because there is not one. The lower panel is how far the phase margin still is from the two-pole loop’s 35.0349°: 1.633° at 200 kHz, 0.1640° at 2 MHz, and 3.28 × 10⁻⁶° at 100 GHz. The faint line is arctan(fc/f₃) in degrees.

The two panels are two straight lines pointing in opposite directions, and the difference between them is the whole content of this essay. The phase margin has a limit. It approaches 35.034911° as the shortfall falls a decade for every decade the pole moves, and the shortfall multiplied by the pole frequency is one constant to within half a per cent across six decades, which is what a reciprocal is when it is measured rather than fitted.

The gain margin has no limit. It rises by 20 decibels for every decade, forever, and the number it is approaching is not a number.

That asymmetry has a name in this collection. A phase margin is continuous in the model’s order — a loop with a distant third pole has nearly the phase margin of the loop without it, and “nearly” can be priced. A gain margin is not: the loop with a third pole at 100 gigahertz has 140 decibels of gain margin and the loop without one has none, and no amount of moving the pole gets from the first statement to the second. One of the two numbers this field quotes side by side survives a small change in the model and the other does not.

The mechanism, which is that the two run out together

The reason is visible in one table and needs no criterion to state it. Two lag sections contribute at most 90° each, so the phase of a two-pole loop approaches −180° and does not reach it. Meanwhile each section rolls the magnitude off at 20 decibels a decade, so a loop that is still approaching −180° is a loop whose magnitude is still falling at 40.

The two run out together, and the arithmetic of that is what makes the gain margin infinite rather than merely large. The two-pole loop’s phase is −179° at 229.7 kHz, where the loop gain is already 7.578 × 10⁻⁴ — 62.41 decibels below unity. It is −179.9° at 2.2976 MHz, at −102.41 decibels. The last degree costs a decade of frequency and 40 more decibels, and the one after that costs the same again. The distance from the locus to the critical point, expressed in decibels, is what the gain margin is; it grows without bound because the remaining tenth of a degree always costs another factor of a hundred in magnitude.

A path that reaches the negative real axis only at the origin. The locus crosses the unit circle 35.0° from the critical point and then never crosses the negative real axis at all: every point within a degree of that axis is already inside 7.39e-4 of the origin. There is no distance to quote as a gain margin, because the curve reaches the axis only where it has run out of magnitude.
Fig. 4 The two-pole loop drawn as one path rather than as two graphs. It crosses the unit circle 35.0° from the critical point and then curls in to the origin along the negative real axis without ever crossing it: every sampled point within a degree of that axis is already inside 7.4 × 10⁻⁴ of the origin. There is nothing on the axis to measure a distance to.

That is the picture the split magnitude-and-phase pair cannot show, and it is the same reason stable, and unstable with less gain had to draw a locus: the criterion is about a curve and a point, and both of these essays are about something a pair of graphs read at one frequency each will not report.

What the criterion says instead

The gain margin’s real content is a statement about gain: how much larger the loop gain could be before the closed loop stops settling. That statement can be made without a margin at all, and it is the statement the criterion itself makes.

Two routes reach it. The cheap one solves for every frequency at which the loop phase passes an odd multiple of 180° and takes the reciprocal of the magnitude at each — the gain that would move the locus exactly onto the critical point. The expensive one integrates the turning of 1+L1 + L around the whole contour and counts encirclements, which is the criterion’s own definition and about four hundred times slower.

A gain axis with an edge on it, and the same axis with none. computed by solving, not by drawing. The upper band is the three-pole loop: stable until its gain is multiplied by 200.902 and unstable above, an edge found twice — once by solving ∠L = −180° and taking the reciprocal of the magnitude there, once by integrating the turning of 1 + L round the whole contour at six gains. The lower band is the same loop with its third pole removed. It has no crossing of −180° at any frequency, so the list of critical gains is empty, and the encirclement count is zero at every gain out to 1e+12. Every gain here is applied as a multiplication on the measured return ratio, which is what the criterion is a statement about: written into the netlist's own gain block instead, anything above ×100.000 makes the nodal matrix singular at the bottom of the contour — below even the three-pole loop's critical gain. The empty list is the answer rather than a failure to find one.
Fig. 5 The gain axis of both loops. The three-pole loop is stable until its loop gain is multiplied by 200.902 and unstable above; both routes put the edge there, and the six probes on that band are the encirclement count agreeing with the solve. The two-pole band has no edge on it. Its turning integral is −3.2 × 10⁻⁶ at a multiplier of 10¹², which is zero rather than a rounded one.

The list of critical gains for the two-pole loop is empty, and an empty list is the answer rather than a failure to produce one. The encirclement count confirms it out to a multiplier of 10¹².

Which raises a question about what those gains are. Every one of them is applied as a multiplication on the measured return ratio, because that is what the criterion is a statement about — a curve and a point, with the gain scaling the curve. Written into the netlist’s own gain block instead, a multiplier above 100 makes the nodal matrix singular at the frequency the contour starts from, and the solve refuses it rather than returning a large plausible number. That refusal sits below the three-pole loop’s own critical gain of 200.902. The edge on that band is therefore a fact about a curve rather than about a circuit anyone could build, which is exactly the distinction the refusal and what it was protecting draws, and it is the reason the criterion can go twelve decades further than the netlist: multiplying a measured return ratio needs no matrix.

Reporting that empty list correctly turned out to need a repair, and it is worth naming because it is exactly the shape of defect this essay is about. Beside the list, the routine that finds the critical gains returns a consistency flag, whose job is to catch a search that has returned a crossing of the positive real axis by mistake — a number that would not be a critical gain at all. It was defined as there is at least one crossing, and every crossing is at an odd multiple of 180°, and on a loop with no crossings it therefore came back false. Nothing was inconsistent. There was nothing to check.

Those are different answers and a flag that gives them the same value cannot tell them apart, so it is two flags now: whether the locus reaches the negative real axis at all, and whether the crossings that were found are real ones — the second vacuously true of an empty list, because none of no crossings is wrong. The two-pole loop is what made the conflation visible, and nothing else could have, because every loop this field had drawn crosses. The same fault appears twice more below in a more expensive form.

The self-checks, and what they are actually checking

The encirclement count carried two numbers that read as its own diagnostics. The first is how far the turning integral is from an integer, offered on the stated grounds that anything above a few hundredths means the grid was too coarse to follow the locus round. The second is the largest angle the locus turned between two sampled frequencies.

Neither had ever been plotted against the sampling it was supposed to diagnose. Plotting them takes a loop with a known answer and a deliberately bad grid, and it is why the first of those two sentences is written in the past tense.

A self-check that is the same number whether the answer is right or wrong. computed by solving, not by drawing. The three-pole loop at 2 times its critical gain — definitely unstable — with the encirclement integral taken over sixteen decades at each of 19 samplings. Crosses mark the samplings that return STABLE, which is wrong: 20, 24 points. The curve is the largest angle the locus turned between two neighbouring samples, and it is the only quantity here that moves. The distance of the integral from an integer — the number the computation used to offer as its own check — is 3.191e-6 at 20 points and 3.191e-6 at 12000: the same to eight figures, at a sampling that gets the answer wrong and at one six hundred times finer. Walking the same angles again at half the sampling does move — it refuses 28 and 40 points — but it agrees with itself at every sampling that is wrong, so it is a refusal when it fires and silence when it does not.
Fig. 6 The three-pole loop at twice its critical gain — definitely unstable — with the encirclement integral taken over sixteen decades at each of nineteen samplings. The two coarsest return STABLE, which is wrong. The curve is the largest turn between neighbouring samples and it is the only quantity that moves. The distance from an integer is 3.191 × 10⁻⁶ at 20 points and 3.191 × 10⁻⁶ at 12,000: the same to eight figures, at the sampling that gets the answer wrong and at one six hundred times finer.

The verdict is wrong below 28 sampled frequencies and right at and above them, and the number that was supposed to say so does not move at all — not merely insensitively, but to eight significant figures, straight across the sampling where the answer changes.

The reason is arithmetic rather than bad luck. The integral is a sum of differences of the same quantity at successive frequencies, so it telescopes: whatever the grid, the total is the angle at the last frequency minus the angle at the first, and the only thing a coarse grid can do is assign a wrapped difference to the wrong branch — which changes the total by exactly a whole turn and leaves its distance from an integer untouched. A residual made of a telescoping sum cannot report an error that is an integer number of turns.

What the residual is measuring is elsewhere entirely.

The gap is measuring where the contour starts, not how finely it is walked. computed by solving, not by drawing. The same integral over the same loop, with the contour's low end moved through seven decades and the sampling changed by a factor of three hundred at each. The three samplings lie on one another to six figures, and the gap is 3.187885e-2 times the starting frequency at every point on it. That is the contour's own truncation: the Nyquist contour runs from zero and this one starts at a finite frequency, where 1 + L still has 0.000574° of phase left to turn at the default start. The gap is exactly that angle in half-turns, to nine figures. It is not a statement about the grid, and reading it as one is how a wrong verdict passes its own check.
Fig. 7 The same integral with the contour’s low end moved through seven decades and the sampling changed by a factor of three hundred at each. The three samplings lie on one another to six figures. The residual is 3.187885 × 10⁻² times the starting frequency at every point, which is the phase of 1 + L there in half-turns — 0.000574° at the default start — to nine figures.

The Nyquist contour runs from zero and a computed one starts at a finite frequency, where the loop still has a little phase left to turn. The residual is that missing piece and nothing else: it falls by a decade when the contour’s low end falls by a decade, and by nothing at all when the sampling changes by three hundred times. It is a real and useful measurement — of contour truncation — and it is not the measurement it was being read as.

The other number does move, and it is the one to read. But it cannot be turned into a threshold either, because it approaches half a turn for two unrelated reasons. A grid too coarse to follow the locus gives large steps; so does a locus passing close to the critical point, where the angle of 1+L1 + L genuinely does swing through nearly 180° in a short span of frequency. At a gain a part in 10⁵ below the critical one, the count is right and the largest step is 179.92°. On the two-pole loop at a multiplier of 10¹² the count is right and the largest step is 179.99°, because the locus is hugging the negative real axis all the way to the origin. Large steps are a warning that the answer may be about the grid; they are not evidence that it is.

What replaced it, and how far it goes

No residual computed from one sampling answers was this grid fine enough, and the honest thing to do with that sentence is to say it rather than to find a substitute. The way to answer the question is the expensive way: refine the contour until the count stops changing.

Half of that is free, and taking it is the repair this measurement produced. The angles at every sampled frequency are already in hand, so the integral can be walked a second time over every second sample, spanning the same contour, at the cost of no further solve. If the two counts differ, the grid is certainly too coarse.

The bound on it is in the same measurement, which is why it can be stated rather than hoped for. At 28 and at 40 sampled frequencies the halved grid disagrees with the full one, and those are exactly where the answer has only just become right — a conservative refusal, and a useful one. At 20 and at 24 the two grids agree with each other and are both wrong. So it is one-way: disagreement proves the sampling is too coarse and agreement proves nothing.

That is a weaker check than the one it replaces and it is the first one either routine has had that is true. A check that fires only sometimes tells a reader which of its answers to believe; one that never fires tells them the opposite of the truth, at whatever sampling they happened to choose.

What this does not say

It does not say a two-pole loop is a model of an amplifier. It is not. Every real device has a third corner, the reason for putting one in this field’s standard loop was correct, and a designer who reads an infinite gain margin off a two-pole macro-model and concludes that the loop cannot be made to oscillate has been told something about the model. The 46.06 decibels of the three-pole loop is the honest figure for a part with a corner at 2 megahertz, and the ideal amplifier, and where it stops being one is where the finite product that makes any of this necessary is measured.

What it says is narrower and harder to design around. A gain margin is a property of the model’s order, not of the loop. Two models that agree to two parts per million about the crossover, and to a sixth of a degree about the phase margin, can differ by everything about the gain margin — and the difference is not detectable at the crossover, which is where the loop was characterised. A macro-model truncated one pole early is exactly the model that gives an infinite gain margin, and truncating a macro-model one pole early is the most ordinary thing anyone does to one.

The practical form of that is a rule about what to trust. A phase margin read from a truncated model is wrong by the phase the missing sections would have contributed at the crossover, which is an arctangent and is small when the sections are far out. A gain margin read from the same model is not wrong by a small amount; it is a different kind of statement. The quantity that survives truncation is the phase margin, and the quantity that does not is the one this field prints beside it.

What is still open

Two things this essay does not reach.

The closed-loop step is not drawn here. Two measurements of one margin requires a phase margin measured in the frequency domain and an overshoot measured in the time domain to agree through the second-order relation, and notes that they part company because the loop has three poles. A two-pole loop is the case where that relation should be exact, and the comparison has not been made.

And nothing here is an amplifier with a limit in it. Every number above comes from a linear solve. The step too large to have an impedance is where the same field stops being linear, and none of the margins on this page survives into that regime as a number either — for reasons that have nothing to do with pole counts.

The number worth carrying

2.45 parts per million in the crossover, 0.164 degrees in the phase margin, and everything in the gain margin.

The habit that goes with it is about how a null answer is shaped. Three instruments here reported nothing, and each did it in a different form: a sentence where a number was expected, an empty list, and a flag that means inconsistent coming back false because there was nothing to be consistent about. Only the first of the three is legible without reading the machinery. A quantity that can fail to exist should say so in the same slot it would have used for its value, because a caller that formats an infinity, an empty list or a false flag as though it were a measurement will do so silently and forever — which is the same argument a boundary is a model and a tolerance makes about edges, applied to the reporting rather than to the edge.

And one more, about self-checks. A residual that does not change when the thing it is checking changes is not a weak check; it is a check of something else, and its steadiness reads as reassurance. Two independent samplings agreeing to eight figures is evidence only if the two samplings could have disagreed — the digits the arithmetic did not have makes the same point about a subtraction that looks converged. The way to find out is to break the computation on purpose and watch which of its numbers notices, which is what the last two figures on this page are, and it costs nineteen evaluations of something that was already written.

Both faults above are repaired rather than only reported: the flag that could not tell nothing to check from this is wrong is two flags, the residual that could not see the grid now says what it does measure, and the free half-sampling comparison stands in its place with its one-way limit written beside it. The figures on this page found all three and are what will keep them found — every sampling that returns the wrong verdict is drawn, so the day a later change makes the residual notice them, an assertion here stops the build.

Part 3 on loop gain

One argument about Loop gain, and one of 3 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

Encirclement countGain marginLoop gainModel rangeNumerical errorNyquist criterionPhase marginStabilityVerification