The Q a rule can show
Assumes: One step, computed twice · Where the behaviour is written down
The rule between the two measured three ways of marching a circuit forward in time on an inductor and a capacitor with no resistance at all. The trapezoidal rule kept the amplitude exactly and fell behind in phase; backward Euler lost almost all of the amplitude in ten cycles; the second-order backward difference, BDF2, lost amplitude only as the cube of the steps a cycle and phase as the square. Every loss of amplitude in that essay was the rule’s, because the circuit had none of its own, and the essay closed by noting that this is the unusual case. A real resonance has a resistor somewhere, it decays at a rate its quality factor sets, and the rule’s invented loss then competes with the circuit’s true one.
That competition has a simple and slightly alarming answer. A damping rule does not add a small error to the circuit’s Q; it imposes a ceiling on it. Above a quality factor fixed by the rule and the step, every circuit looks the same, because the rule’s loss is all the march can show. This essay measures the ceiling for each rule, the steps a cycle needed to stay well below it, and what the ringing itself looks like when the ceiling is near.
The quality factor a march shows
Put a resistor in series with the earlier essay’s inductor and capacitor — 10 mH and the capacitor that resonates with it at 1 kHz — and choose the resistor to set a quality factor, . Step the input by a volt and march the circuit at N steps per undamped cycle.
A linear circuit marched by any of these rules obeys a fixed recurrence: each step multiplies the ringing by one complex factor . The march therefore behaves exactly like a continuous resonance whose pole is , and that pole has a quality factor of its own, . That is the number a reader of the marched waveform would measure — the decay per radian of its own ringing — and it is what this essay calls the Q the march shows. It can be computed in two independent ways. One is in closed form, from each rule’s factor at the circuit’s exact pole: the trapezoidal rule’s , backward Euler’s , and BDF2’s root , with . The other is from the march itself, by fitting the exact two-term recurrence a ringing obeys to the whole marched record.
The two routes agree to better than 0.3 per cent at every point where both are drawn. At twenty steps a cycle, a circuit with Q = 3 is shown as 3.05 by the trapezoidal rule, 3.06 by BDF2 and 1.62 by backward Euler. At Q = 30 the three show 30.5, 22.5 and 2.97. At Q = 300 they show 305, 62.6 and 3.24. Backward Euler has already flattened before the circuit’s Q reaches ten; BDF2 follows the circuit to about Q = 10 and then bends over; the trapezoidal rule never departs from the diagonal by more than the same 1.64 per cent.
The flattening has a name. However large the circuit’s Q, the rule’s own loss per cycle remains, and the shown Q cannot exceed the Q of the rule’s loss alone. At twenty steps a cycle that ceiling is 3.27 for backward Euler and 77.9 for BDF2. A 1 kHz resonance with a Q of 300, or 3,000, or a lossless one, marched with backward Euler at twenty steps a cycle, decays as a Q of about three would.
The trapezoidal rule’s error is a ratio
The trapezoidal rule’s line is different in kind, not just in size. Its factor on the imaginary axis has a magnitude of exactly one, so a lossless circuit marches without loss and there is no rule-made damping to impose a ceiling. What it does have is the phase error the earlier essays measured: its frequency is , slightly slow. A damped pole is mapped with its decay rate and its frequency both warped by nearly the same factor, and the Q the march shows comes out multiplied by a constant that depends on the step and not on the circuit — 1.0164 at twenty steps a cycle, the same at Q = 10 as at Q = 100 to the precision drawn.
The slider shows how the three change with the step. At ten steps a cycle the ceilings are 1.76 and 14.5 and the trapezoidal ratio is 1.065. At fifty they are 7.99 and 1,042, and the ratio 1.0026. At a hundred, 15.9 and 8,132, and the ratio 1.0007.
At a hundred steps a cycle BDF2 follows the circuit to within one per cent up to Q = 100 and is still within ten per cent at 500; backward Euler’s shown Q is 15.7 for a circuit of a thousand. Five times the steps moved BDF2’s ceiling by a factor of a hundred and backward Euler’s by five. That difference is the next figure.
The ceiling against the step
The leading-order behaviour of each ceiling follows from the per-cycle losses the earlier essay measured. Backward Euler loses nepers a cycle on a lossless resonance, and a resonance of quality factor loses , so its ceiling is . BDF2 loses a quantity that falls as , about nepers, and its ceiling is .
Both laws are approached from above at small step counts and met closely at large ones. At ten steps a cycle backward Euler can show 1.76 and BDF2 14.5; at twenty, 3.27 and 77.9; at fifty, 7.99 and 1,042; at a hundred, 15.9 and 8,132. A first power against a cube. The trapezoidal rule is absent from the figure because it has no ceiling to draw.
The practical reading is a rule of thumb that is easy to carry. With backward Euler, the steps per cycle must be several times for the circuit’s own loss to dominate the rule’s — a Q of a hundred wants well over six hundred steps a cycle. With BDF2 the cube makes it cheap: the steps per cycle must be several times , which is 23 for a Q of a hundred and 50 for a Q of a thousand.
How many steps to read Q to a per cent
“Several times” can be made precise. Bisect, for each rule and each circuit Q, on the steps per cycle at which the Q the march shows is within one per cent of the circuit’s.
The trapezoidal rule needs between 25 and 26 steps a cycle at every Q from three upwards — 25.3 at Q = 3, 25.6 from Q = 10 on — and 22.2 at Q = 1. BDF2 needs 44 at Q = 1, 32.5 at Q = 10, 98.7 at Q = 100 and 178 at Q = 500. Backward Euler needs 463 at Q = 1, 6,204 at Q = 10, 62,202 at Q = 100 and 311,017 at Q = 500 — very nearly , which is the one-per-cent version of the ceiling law.
BDF2’s need is not monotonic at low Q, and the reason is worth seeing. It needs 44 steps a cycle at Q = 1, only 12 at Q = 3, and 32.5 at Q = 10. At Q = 1 the circuit is heavily damped and BDF2’s amplitude loss is small beside the circuit’s; what moves its shown Q there is the phase error, four times the trapezoidal rule’s, which slows the shown frequency and pushes the shown Q up — 1.044 for a circuit of 1 at twenty steps a cycle. At Q = 10 the amplitude loss has taken over and pushes it down, to 9.32. Somewhere near Q = 3 the two errors cross and cancel in the summary, which is why so few steps suffice there: a coincidence of opposite errors rather than an accurate march, since the waveform is still late in phase. Above Q = 10 the amplitude loss is all that matters and the cube-root growth sets in.
The comparison across the three is stark at the Q values circuits actually have. A crystal or a ceramic resonator’s Q of thousands is out of backward Euler’s reach at any affordable step and within BDF2’s at a couple of hundred steps a cycle. A tuned amplifier’s tank at Q = 50 is within the trapezoidal rule’s reach at 26 steps a cycle, within BDF2’s at about 75, and needs over thirty-one thousand for backward Euler. A lightly damped filter section at Q = 3 is the one place backward Euler is merely expensive rather than hopeless, at about 1,800 steps a cycle.
What the ringing looks like
A shown Q is a summary. The waveform it summarises is the ringing after a step, and the difference between rules is clearest there.
At Q = 50 the circuit loses 0.0628 nepers a cycle, π/Q with the small correction for the damped frequency, and after ten cycles 0.533 V of the first volt of ringing is left. The trapezoidal march has 0.536 V, losing 0.0619 nepers a cycle — slightly less than the circuit, as its 1.6 per cent high Q says it should. BDF2 has 0.346 V, losing 0.0994 nepers a cycle, of which the circuit accounts for 0.063 and the rule for the rest: at Q = 50 and twenty steps a cycle the rule’s own loss is more than half the circuit’s. Backward Euler loses 1.03 nepers a cycle, and its ringing is under a millivolt by the tenth cycle. A reader looking at the backward-Euler waveform would see a resonance damped about as heavily as a Q of three, which is what the ceiling said.
The peaks are sampled at the step instants, so each carries a small scalloping as the true peak falls between samples; the same sampling is applied to the exact response, so the comparison between them is like for like.
At Q = 5 the circuit loses 0.632 nepers a cycle and its ringing is two millivolts after ten cycles. The trapezoidal march loses 0.621 and BDF2 0.630 — at this Q BDF2 is actually the closer of the two, because the circuit’s own loss swamps its added damping and its phase error is too small to matter over so few visible cycles. Backward Euler loses 1.52 nepers a cycle, more than twice the circuit’s, and still looks like a resonance, but of the wrong Q. Q = 5 is near backward Euler’s ceiling at this step, and the figure shows what “near the ceiling” means: the rule’s loss and the circuit’s are of similar size and neither can be read without the other.
What this means for choosing a rule
The earlier essays found that the trapezoidal rule rings at half the stepping rate after a discontinuity, and that the backward rules do not. This one finds the price of the backward rules on the other kind of ringing, the kind the circuit actually does. For a resonance, a damping rule is a low-pass filter on the quality factor: the circuit’s Q passes until it reaches the rule’s ceiling, and above that only the ceiling is seen.
That frames the choice between rules by the Q the circuit contains. A circuit whose highest Q is a few — a power stage’s snubbed ringing, a well-damped control loop — can be marched with anything at modest steps. A circuit with a Q of tens wants either the trapezoidal rule or BDF2 at several tens of steps a cycle. A circuit with a Q of hundreds or thousands, marched with a backward rule, needs the step chosen against the ceiling law and not against the waveform’s apparent smoothness, because a too-coarse march produces a waveform that is smooth, plausible and wrong in exactly the quantity a resonator is built to have.
A worked tank: which requirement sets the step
Take a 100 kHz tank with a Q of 200, simulated for a millisecond — a hundred cycles, long enough to watch it ring down by a factor of nearly five. Three requirements now compete for the step, and which one wins differs by rule.
To show the Q within one per cent, the trapezoidal rule needs 25.6 steps a cycle, BDF2 128 and backward Euler 124,406. To stay within one per cent of a cycle in phase over the hundred cycles, The rule between the two found 182 steps a cycle for the trapezoidal rule and 363 for BDF2. So for the two second-order rules the phase requirement is the binding one, by a factor of seven for the trapezoidal rule and about three for BDF2: a march fine enough to keep the ringing on time is already fine enough to keep its decay right. For backward Euler the order is reversed. Its Q requirement alone is 12.4 million steps for the millisecond, and nothing else comes close.
That ordering is the useful summary. For the trapezoidal rule and BDF2 the Q a march shows is a by-product of getting the phase right, and a designer who has chosen the step for phase can trust the decay. For backward Euler the decay is the first thing to go and the last to be fixed, and a waveform whose timing looks plausible can carry a Q several orders of magnitude too low. A march started with a few backward-Euler steps at each discontinuity, as The ringing that belongs to the rule recommended, pays this price only over those few steps: at 182 steps a cycle each backward-Euler step removes about 0.06 per cent of the ringing’s amplitude, once, rather than a rule-made loss every cycle.
The Q the components allow measured how real components’ resistance caps a circuit’s Q. This is the same kind of cap, imposed by the arithmetic of a simulation rather than by the parts, and it has the same consequence: a resonance designed for a Q above the cap is not the resonance that is measured. Where the behaviour is written down put a second-order circuit’s whole behaviour into its two poles; the march’s pole, , is the pole the march actually has, and reading its Q is reading where the rule has moved it.
How the numbers were obtained
The circuit is a 1 V step driving a series resistor, a 10 mH inductor and the capacitor that resonates with it at 1 kHz, with the resistor set for each quality factor. Each march is the circuit’s nodal equations integrated with each rule’s companion model, BDF2 started with one backward-Euler step. The Q a march shows is measured from its record by fitting, by least squares, the two-term recurrence that a single pair of complex roots obeys, over eight cycles and after the first forty steps for BDF2, whose parasitic root must first die away; and give the factor and so the Q. The closed-form lines evaluate each rule’s factor at the circuit’s exact pole. The ceilings are the closed forms at an infinite circuit Q, and the steps for one per cent are bisected on them. The envelope figures take the largest distance from the final value within each cycle of samples, for the marches and for the exact response at the same instants.
What it leaves out
A real simulator’s variable step. Every march here has a fixed step. A simulator chooses its step to hold an error estimate within a tolerance, and on a high-Q resonance that estimate is dominated by phase; whether the step it chooses lands above or below the ceiling law is the controller’s behaviour, not the rule’s.
Several resonances at once. A circuit with a fast high-Q resonance and a slow one is marched with one step; the fast one sees few steps a cycle and the slow one many. The ceiling applies to each at its own N, so the fast resonance can be at its ceiling while the slow one is perfect.
Nonlinear loss. A circuit whose damping depends on amplitude — a diode-clamped tank, a magnetic core — has no single Q to show, and a rule’s added damping then also changes the amplitude at which the circuit’s own loss acts.
Still open: the controller’s choice, BDF3, and the frequency the rule shows
The step a controller chooses. A variable-step BDF2 or trapezoidal march holds a local error estimate within a tolerance. On a resonance of known Q, the step that controller settles on, and therefore the Q its march shows, is a measurement this circuit can make directly: march it with a controller at three tolerances and read the shown Q against the ceiling law at the step it chose.
BDF3. One more step of history raises the order and should move the ceiling to a higher power of N — but BDF3 is not stable on part of the imaginary axis’s neighbourhood, and a lightly damped resonance lives there. Whether its ceiling rises as , or whether it instead grows a resonance the circuit does not have, is the next rule to put through these four figures.
The frequency the rule shows. This essay read the march’s pole for its Q; the same pole has a frequency, and every rule shows a resonance slightly slow. A crystal oscillator’s frequency is the quantity that matters and its Q is a few thousand, so the frequency error at the steps the Q requires — and whether matching one forces the other — is the companion measurement, and the one an oscillator designer would ask for first.
Part 5 on step response
One argument about Step response, and one of 5 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.
Damping ratioMarchingNumerical errorQuality factorRingingTrapezoidal rule
- The arrow that goes past where it settles marching, quality factor, trapezoidal rule
- A sweep that never stops marching, quality factor
- Five readings of one Q damping ratio, quality factor
- The delay an inductance does not add damping ratio, ringing
- The envelope that leaves early quality factor, trapezoidal rule
- The floor that outlives the arithmetic numerical error, quality factor