The ringing that belongs to the rule
Assumes: One step, computed twice · Where the behaviour is written down
One step, computed twice set a step response from the poles beside the same response walked forward in time with the trapezoidal rule, and found the gap between them falling by a factor of four whenever the step was halved — the rule’s second order, watched happening. It recommended the rule over its two simpler neighbours, and then, honestly, named the one place it misbehaves: applied to a circuit with a very fast pole and a long step, it does not blow up, but it produces an oscillation at the step frequency that has nothing to do with the circuit and looks exactly like ringing.
That essay stopped at a description and a rule of thumb — if the ringing changes when the step changes, it belongs to the method. This one measures it. The oscillation turns out to have an exact amplitude, an exact decay, a location in the circuit, and a remedy whose price can be counted in steps.
The two routes, where they agree
The starting point is the agreeable case. A resonant circuit with a damping ratio of 0.22, stepped five hundred times over its response, is within 1.7 millivolts of the exact curve everywhere, and the gap shrinks as the square of the step. Every pole of that circuit is slow against the step: the step is a small fraction of both its time constant and its period. The rule’s error is then the smooth, second-order error the earlier essay measured, and nothing about it could be mistaken for a feature of the circuit.
The misbehaviour needs a pole that is fast against the step, and a circuit with any spread of time constants has one.
A fast pole and a slow one
The circuit here is the smallest one that has both. A one-kilohm resistor and a one-nanofarad capacitor make a pole with a time constant of one microsecond. Through a unity buffer, that node drives a one-kilohm resistor and a one-microfarad capacitor, a pole of one millisecond. The buffer keeps the two poles separate, so each node is a single real pole’s response and each rule’s behaviour on it can be read off exactly.
A simulator interested in the millisecond pole takes steps a small fraction of a millisecond — twenty microseconds is a fiftieth — and the microsecond pole is then twenty time constants per step.
The exact node reaches its final volt in a few microseconds, which is to say within the first step. The marched node reads 1.8182 volts after one step, 0.3306 after two, 1.5477, 0.5519, 1.3666. It overshoots by eighty per cent, undershoots by sixty-seven, and swings back and forth around the right answer, shrinking slowly. Drawn as a line through the points it is a decaying oscillation with a period of two steps — forty microseconds, twenty-five kilohertz — in a circuit with no inductance anywhere and no frequency of twenty-five kilohertz in it.
The figure checks the swing’s exact law. The node’s distance from its final volt is multiplied by the same factor every step, and the factor is : at twenty time constants a step, −0.8182. The figure checks it to a part in a million at each of the first eleven steps. The swing is not an approximation to anything; it is the rule’s own recurrence, applied to a pole, and with that factor the distance takes twenty-three steps — 460 microseconds, nearly half a millisecond — to fall below one per cent.
Two neighbouring measurements explain why this circuit is worth building. Where the behaviour is written down put everything a network does into where its poles are, and this circuit has its poles a thousand times apart on the real axis — a spread no single step can resolve. The cancellation that leaves a tail found a pole and a nearby zero leaving a slow tail that a quick look misses; this is the opposite error, a fast pole leaving a fast artefact that a quick look mistakes for physics. And the step that is too big used the word step for an input too large for an amplifier’s linear range; here the step that is too big is the simulator’s.
Where the ringing goes
The ringing is on the fast node. The slow node that the fast node drives is marched correctly all the time: at one millisecond it is 1.23 × 10⁻⁵ volts from exact, which is the rule’s ordinary second-order error at a step of a fiftieth of that pole’s time constant.
That is the reason the artefact survives. The alternation is at half the stepping rate, and the one-millisecond pole averages anything at twenty-five kilohertz to nothing. So a designer looking at the output — which is where the slow node usually is — sees a correct waveform, and a designer probing the internal node sees ringing, and both are looking at the same simulation. The error is real, it is local, and it does not propagate to the part of the circuit whose time constants the step was chosen for.
It does propagate to anything that responds to the fast node’s value rather than its average: a comparator watching it, a diode it forward-biases, a nonlinear element whose operating point depends on it. A 1.8-volt overshoot on a node that never exceeds one volt is enough to turn on a clamp in the simulation that never turns on in the circuit.
A longer step makes it worse, and in the direction nobody would expect from an error that is supposed to shrink with the step. At a hundred time constants a step the fast node swings between 1.96 and 0.08 volts, the factor is −0.9608, and the swing takes 116 steps — eleven and a half milliseconds, longer than the slow pole’s whole response — to fall below one per cent. The slow node is now 9.8 × 10⁻⁴ volts out at a millisecond, but for its own reason: a hundred microseconds is a tenth of its time constant, and its second-order error has grown with the step as it should.
The first swing, in closed form
The size of the first overshoot follows from the factor with no further work, and it is worth having because it is the number that turns on clamps. The node starts at zero with its final value at one volt, so its first distance from the final value is one; after one step that distance is multiplied by the factor, and the node reads . With the first value is , and the overshoot is .
At twenty time constants a step that is 1.8182 volts, eighty-two per cent over. At a hundred it is 1.9608, ninety-six per cent over. As the step grows the first value approaches two volts, and the next approaches zero: a very long step makes the trapezoidal rule’s fast node swing between twice its final value and nothing, which is exactly what an undamped resonance excited by a step would do. Nothing in the waveform distinguishes the two except its period, which is two steps.
Reading the time constant off the ringing
Because the factor is exact, the false ringing is a measurement, and it can be read backwards. If a marched node alternates and its distance from its settled value shrinks by a factor each step, then , and the node has a pole of time constant
At that is a twentieth of the step, one microsecond at twenty; at , a hundredth. A designer who sees an alternating waveform on an internal node and measures two consecutive swings has the time constant of a pole the simulation was not resolving, and knows how short the step would have to be to resolve it: shorter than twice that time constant, for the factor to be positive at all.
That is a more useful diagnosis than the rule of thumb it replaces. Shortening the step and watching the ringing change tells a designer the ringing is false. Reading the factor tells them where it comes from — a transistor’s gate resistance and its gate capacitance, a snubber, the parasitic capacitance across a resistor that the model included and the designer forgot — and what it would cost to resolve it.
The same factor explains an observation from elsewhere on this subject. Two numbers without solving for the waveform marched a series RLC and found the node between its resistor and inductor straddling the answer on its first two steps, because that node is not a state: it jumps at the first instant, and a jump is a pole infinitely faster than any step. Its first marched values are the trapezoidal rule’s −1 factor applied to a discontinuity, and the phase the rule loses is the same rule’s behaviour on the poles it resolves — kept in amplitude and lost in phase. The gap a derivative needs measured how the damping near a double pole makes sensitivities blow up; a stiff circuit is the opposite geometry, poles as far apart as a circuit can put them, and its difficulty is not sensitivity but resolution.
Where stiff circuits come from
The circuit here was built to be stiff, with a thousand to one between its time constants. Real circuits arrive at the same ratio without anyone choosing it, and the commonest source is the parasitic that makes a model realistic.
A switching converter’s control loop settles in milliseconds; its switch’s gate charges through a few ohms into a few nanofarads in nanoseconds; its snubber and its layout inductance ring in tens of nanoseconds. A model that includes all three, marched with steps chosen for the loop, is a circuit with a hundred thousand to one between its time constants, and every internal node attached to the fast ones is a candidate for this alternation. A precision amplifier with a compensation network whose zero is placed far above its crossover is the same shape at a smaller ratio.
The trap is that adding realism makes the problem, not the design. A model of a converter without its gate resistance has no fast pole and no false ringing; add the resistance to make the model honest, and a step that was adequate becomes twenty time constants of a new pole, and a waveform that was smooth acquires a ringing that looks like the parasitic resonance the designer was trying to model. The two are distinguishable only by period, and a designer expecting to see ringing will not be looking at the period. The measurement that settles it takes two consecutive samples and a division.
Why the trapezoidal rule does this and backward Euler does not
Each rule advances a pole by multiplying its distance from equilibrium by a fixed factor per step, and the three factors on one axis are the whole story. The exact factor is , which is always between zero and one and goes to zero as the step grows: a long step jumps a fast pole straight to its final value. Backward Euler’s factor, , has the same shape — between zero and one, going to zero — so a long step also jumps it most of the way. The trapezoidal factor agrees with both for short steps, crosses zero at exactly two time constants, and then turns negative and approaches −1.
The figure measures the factors on the marched node at four ratios and checks them against the three expressions to a part in a million. At half a time constant the trapezoidal factor is 0.6000 against backward Euler’s 0.6667 and the exact 0.6065 — the trapezoidal rule is the better of the two, which is why it is standard. At five time constants it is −0.4286; at twenty, −0.8182; at two hundred, −0.9802.
The numerical-analysis name for the distinction is that both rules are A-stable — neither’s factor ever exceeds one in magnitude for a stable pole, so nothing blows up — but only backward Euler is L-stable, meaning its factor goes to zero for an infinitely fast pole. The trapezoidal rule’s goes to minus one. It preserves the magnitude of an error it cannot resolve and flips its sign every step, and that is the ringing.
The same property is what one step, computed twice praised the rule for. A factor whose magnitude is exactly one on the imaginary axis is what keeps a lossless oscillator’s amplitude constant — the next measurement on this subject takes that up. The trapezoidal rule does not distinguish between a pole it should preserve and a pole it should kill, because both are, to it, poles it cannot resolve at this step.
The remedy, and what it costs
A simulator does not give up the trapezoidal rule’s accuracy on the slow poles to fix the fast ones. It takes one or two backward-Euler steps immediately after a discontinuity — a step input, a switch closing — and returns to the trapezoidal rule afterwards.
At twenty time constants a step, the first backward-Euler step leaves the fast node 0.0476 volts from its final value instead of 0.818 — the factor — and the figure checks it. Two leave 2.27 × 10⁻³ volts, its square. The trapezoidal rule then carries whatever it is handed with its factor of −0.8182, so the ringing is still there, but it starts seventeen times smaller after one damping step and three hundred and sixty times smaller after two: the node is within one per cent from step nine with one, and from step two with two.
The price is paid on the slow poles, for the length of the damping steps. Backward Euler’s error in a single step is of the order of of the pole’s excursion, where the trapezoidal rule’s is of the order of — at a fiftieth of the slow time constant, two parts in ten thousand against seven in ten million — and that error is then carried forward by the trapezoidal rule, which neither grows nor removes it. The remedy trades a short, first-order blemish on the slow response for the removal of a long, false oscillation on the fast one, and it is applied only where a discontinuity has just excited the fast pole.
And the other remedy, which is always available and rarely affordable: take a step shorter than twice the fast time constant. At half a microsecond a step the fast node rises smoothly, 0.40, 0.64, 0.78, with a factor of 0.6000 and no sign change, and the slow node is 7.7 × 10⁻⁹ volts from exact. It costs ten thousand steps over five milliseconds where two hundred and fifty sufficed for the slow node, which is the definition of a stiff circuit: one whose fastest pole sets the step a rule needs and whose slowest sets how long it must be run.
What the rule of thumb becomes
The earlier essay’s test — shorten the step, and if the ringing changes it belongs to the method — is now a measurement with a number in it.
The false ringing has a period of exactly two steps. Any oscillation in a marched waveform at half the stepping rate is the rule’s, and one at any other frequency is not.
Its decay per step is for the pole that produces it, so its decay rate names the pole: at −0.8182 the node has a time constant of a twentieth of the step. Read backwards, the false ringing is a measurement of a time constant the step was too long to resolve.
It appears on the node of the fast pole, not on the nodes that pole drives through a slower one. A correct-looking output is no evidence that an internal node is correct.
It gets longer, not shorter, as the step grows past the fast pole. At twenty time constants a step it lasts twenty-three steps; at two hundred, two hundred and thirty-one.
Still open: amplitude and phase on a pole that should ring, the damping steps’ own cost, and the step a variable-step rule chooses
A pole that should ring. The trapezoidal rule’s factor has magnitude exactly one for a pole on the imaginary axis, which preserves an undamped oscillation’s amplitude, and backward Euler’s is less than one, which invents a loss. The phase the rule loses measures what each costs over many cycles, and finds the trapezoidal rule’s price paid in phase rather than amplitude.
The damping steps’ cost, measured. The first-order error the backward-Euler steps leave on the slow node is estimated above rather than drawn. Marching the same circuit with one and two damping steps against the exact slow response would put a number on how much accuracy the remedy takes back, and whether a half-step of backward Euler buys the same damping for less.
A step chosen by the rule. Real simulators vary the step to hold an estimate of the local error, and the estimate is made from the difference between two rules. On a stiff circuit the estimate sees the slow node’s smooth error and not the fast node’s alternation, which is smooth in its envelope — so whether error control notices the false ringing at all, or lengthens the step through it, is the question that decides how often this artefact reaches a designer’s screen.
Part 2 on step response
One argument about Step response, 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:
What links here
Essays that reach for this one mid-argument — the half of a link its own author cannot write down.
The objects named here
The third axis, after the field and the idea: the things themselves, and every essay that touches each one.
Convergence orderMarchingModel rangeNumerical errorResiduesStep responseTrapezoidal rule
- The digits the arithmetic did not have convergence order, model range, numerical error
- The instrument's own rise time convergence order, model range, step response
- The optimum a spectrum moves convergence order, model range, numerical error
- Two ladders the terminals cannot tell apart marching, model range, residues
- A sum that is exact, and the estimate that is not model range, numerical error
- Every derivative, and the one that is zero model range, numerical error