Where a signal becomes a number

The pulse a loop has room for

Each rectangle a converter's output pulse adds and the analogue pole that rejects the nearest image as much trade at the same rate — the extra rectangle is the cheaper of the two below a quarter of the clock, whatever the pulse's length — so the cubic pulse changes nothing about which is cheaper per rectangle. It changes the total. An integrator loop has ninety degrees to spend, the three poles that match the cubic's three extra sincs sit at the crossover and lag 135 between them, and a hold followed by them does not settle at any crossover. The cubic's two clocks fit: marched, it overshoots 13.6% at a twentieth of the clock and 26.4% at a sixteenth, where its delay spends forty-five degrees. Keeping that margin at 5% of the clock, a pulse of five rectangles puts the image 128 dB below the signal; the best arrangement of equal poles, six of them near half the clock rather than at the crossover, 67.

Assumes: The staircase on the way out · What is left at crossover

A converter’s output pulse can be one clock-long rectangle, which is the hold, or several convolved together: two give straight lines between the samples, four the cubic B-spline. Four rectangles and no filter measured what that buys a converter feeding a loudspeaker — each rectangle is one more sinc, worth one more pole of image rejection, and at three or four times oversampling the cubic replaces the analogue filter entirely, at a price of two clocks of delay that nobody listening hears.

Half a clock against a pole moved the straight line inside a control loop, where delay is not latency but phase at the crossover, and found it the cheaper way to reject an image: the pole that does the second sinc’s job sits at the crossover and lags forty-five degrees there, while the straight line’s extra half clock costs 180 r180\,r degrees for a loop crossing over at a fraction rr of its clock. It ended by asking what happens to the cubic. Four rectangles are worth three poles. Three poles at the crossover cost 135 degrees, and the cubic’s extra clock and a half cost 270 r270\,r. The question was the crossover below which the long pulse is the only way to get that much rejection into a loop at all — and the answer turns out to be that there is no crossover at which the poles are a way at all.

The same rate, rectangle by rectangle

The first thing to settle is whether a longer pulse changes the trade the straight-line essay measured, and it does not. Each rectangle multiplies the converter’s response by one more sinc, and relative to the signal at the crossover a sinc leaves the nearest image, at 1−r1 - r of the clock, lower by exactly (1−r)/r(1 - r)/r — a distance ratio, which the nulls are where nothing is found to be what every sinc does at an image’s own frequency. That factor does not depend on how many sincs came before. So each rectangle adds the same rejection and the same half clock, and the analogue pole that matches it is the same pole, at sinc(r)\mathrm{sinc}(r) times the crossover, lagging the same forty-five degrees.

The consequence is that the straight-line essay’s crossing, r=0.260r = 0.260, where a half clock and a pole cost the same phase, is the crossing for every rectangle of every pulse. Below a quarter of the clock an extra rectangle is always the cheaper filter, rectangle for rectangle. If that were the whole story the cubic would be the straight line three times over and would need no essay — the pole-per-rectangle law that the pole a straight line is worth began from, applied three times.

Ninety degrees, and three poles that want 135

It is not the whole story, because a loop does not pay per rectangle. It pays in total, out of a fixed budget.

Each rectangle and its pole trade at the same rate — but three poles at the crossover lag 135 degrees and the loop has ninety. computed by solving, not by drawing. The lag each reconstruction adds at an integrator loop's crossover, against the crossover as a fraction of the sample rate: pulses of one to four rectangles, 180·n·r degrees, and the hold followed by the three equal poles that reject the image as much as the cubic does, 180r plus three times each pole's arctangent. Ninety degrees is all the margin an integrator has (upper rule) and forty-five is a usual target (lower). The three poles start above 135 degrees however slow the loop, so no crossover leaves that loop any margin. The cubic reaches forty-five degrees of lag at a sixteenth of the clock and ninety at an eighth. Each extra rectangle is cheaper than the pole it replaces below r = 0.260, the same crossing for every pulse length.
Fig. 1 The lag each reconstruction adds at an integrator loop’s crossover against the crossover: pulses of one to four rectangles, 180nr degrees, and the hold followed by the three equal poles that match the cubic, which start above 135 degrees however slow the loop. Ninety degrees is all an integrator has; the cubic reaches forty-five at a sixteenth of the clock.

An integrator plant lags ninety degrees on its own, so a loop around it has ninety degrees of margin before anything else is added, and everything a reconstruction lags comes out of those ninety. The pulses cost 180 n r180\,n\,r — straight lines through the origin, steeper for each rectangle. The hold followed by three equal poles costs the hold’s 180 r180\,r plus three arctangents, and since each pole sits at the crossover each arctangent is very nearly forty-five degrees: the curve starts above 135 degrees at the slowest loop drawn and climbs. It never comes below the ninety-degree line. No crossover, however low against the clock, leaves the hold-and-three-poles loop any margin at all.

The cubic’s line, 720 r720\,r, crosses the forty-five-degree mark at a sixteenth of the clock and the ninety-degree mark at an eighth. Below a sixteenth, a loop built on the cubic keeps more than forty-five degrees of margin; between a sixteenth and an eighth it keeps some; above an eighth it keeps none, and a loop with a delay in it can then fail on more than one side, as stable, and unstable with less gain found. That is the boundary the straight-line essay asked for, and its shape is different from what it expected. The poles do not lose to the cubic below some crossover; they lose everywhere, and the cubic wins only where it fits.

What the marched loop does with them

A phase argument treats a sampled loop as a continuous one with a delay in it. The marched loop is the measurement.

At 5% of the clock the cubic pulse overshoots 13.6%, and the hold with the three poles it replaces does not settlecomputed by solving, not by drawing, marched at 80 steps a clock. A unit step through a loop whose plant is an integrator crossing over at 5.00% of the sample rate, with the converter's output pulse one to four rectangles long — hold, straight line, quadratic and cubic — overshooting 0.0%, 0.0%, 2.9%, 13.6%; and the hold followed by the three analogue poles that reject the nearest image as much as the cubic's three extra sincs, each at 0.997 of the crossover. Those three poles lag 135 degrees at the crossover between them and the integrator has ninety to give, so that loop grows without limit and is drawn until it leaves the axis.00.50011.502020406080time (clocks)output, for a unit stephold, 0.5 clocksovershoot 0.0%straight line, 1 clockovershoot 0.0%quadratic, 1.5 clocksovershoot 2.9%cubic, 2 clocksovershoot 13.6%hold and three polesdoes not settlesolved, then checked — five sampled loops, marchedthree poles, ninety degrees
Fig. 2 A unit step through a sampled integrator loop crossing over at 5% of its clock, for pulses of one to four rectangles — overshoot 0.0%, 0.0%, 2.9% and 13.6% — and for the hold followed by the three poles that reject the image as the cubic does, each at 0.997 of the crossover, which grows without limit.

At a twentieth of the clock the hold and the straight line step cleanly with no measurable overshoot, the quadratic pulse overshoots 2.9 per cent and the cubic 13.6. The hold followed by three poles at the crossover rings and grows, and is drawn until it leaves the axis. The slider on the figure at the head of the page moves the crossover to 3 per cent of the clock, where the cubic too steps cleanly, and to a sixteenth, where it overshoots 26.4 per cent; the three-pole loop grows at every setting.

So the cubic’s rejection can be put into a loop and the equal poles’ cannot. That reads like a verdict on poles, and it is narrower than that. It is a verdict on poles matched one for one to the sincs they replace, which is the definition the straight-line essay used; each such pole sits at the crossover because a sinc’s rejection is a distance ratio and a single pole achieves the same ratio only from the bottom of the band. Three of them put all three of their forty-five degrees exactly where the loop is counting. A designer would not build that filter, and the fair comparison spends the same margin on poles placed where they are best — which is done below.

Forty-five degrees, marched

First, the phase estimate of where each pulse spends forty-five degrees deserves checking, since it was optimistic for the straight line at a fifth of the clock.

Marched, each pulse overshoots about 26% where its delay spends forty-five degrees: the cubic at a sixteenth of the clock. computed by solving, not by drawing, each point a marched step. Overshoot of the sampled integrator loop against its crossover as a fraction of the sample rate, for output pulses of one to four rectangles. The rings mark where each pulse's delay, n/2 clocks, spends forty-five degrees at the crossover — r = 1/(4n): the straight line at an eighth of the clock overshoots 25.3%, the quadratic at a twelfth 26.0%, the cubic at a sixteenth 26.4%. The longer the pulse, the slower the loop at which it reaches that margin, and the better a continuous estimate describes the sampled loop there. The cubic overshoots 0.0% at 3% of the clock and 65.5% at 10%.
Fig. 3 Marched overshoot of the integrator loop against its crossover for pulses of one to four rectangles. The rings mark where each pulse’s delay spends forty-five degrees, r = 1/(4n): the straight line at an eighth of the clock overshoots 25.3%, the quadratic at a twelfth 26.0%, the cubic at a sixteenth 26.4%. The hold reaches forty-five degrees only at a quarter of the clock, where it overshoots 57.1%.

The overshoots at the forty-five-degree points are 25.3, 26.0 and 26.4 per cent for the straight line, the quadratic and the cubic — very nearly one number. The longer the pulse, the slower the loop at which its delay reaches that margin, and the slower the loop the better a continuous estimate describes the sampled one; the cubic’s forty-five degrees arrive at a sixteenth of the clock, comfortably inside the range where the estimate holds. The hold, whose half clock reaches forty-five degrees only at a quarter of the clock, overshoots 57.1 per cent there, which is the failure of the estimate the straight-line essay found, at its most extreme.

The cubic’s overshoot climbs steeply with the crossover: none at 3 per cent of the clock, 4.6 at 4, 13.6 at 5, 26.4 at a sixteenth, and 65.5 at a tenth. A loop crossing over at a tenth of its clock — a common ratio for a fast digital controller — cannot use the cubic, and the reason is visible in the lag figure: at a tenth the cubic alone spends seventy-two of the ninety degrees.

A pulse is a delay with a little gain taken off

The overshoot at the forty-five-degree points is about 26 per cent, where the margin a delay spends found 28.7 per cent for a loop whose forty-five degrees came entirely from a pure delay. The difference is the pulse’s own magnitude. A pulse of nn rectangles is a delay of n/2n/2 clocks and a factor of sincn(r)\mathrm{sinc}^n(r) on the gain, which at the cubic’s forty-five-degree point is 0.9944=0.9750.994^4 = 0.975, a quarter of a decibel. Less gain moves the crossover down a little, and at the lower crossover the delay lags a little less, so the real margin is slightly more than forty-five degrees and the overshoot slightly less.

The correction is small and it runs in the pulse’s favour. It is the same sinc that does the rejecting, felt at the crossover rather than at the image: a few tenths of a decibel of droop there, the price the staircase on the way out measured for a converter feeding a loudspeaker, here repaying a degree or two of margin.

Spending the margin well

The fair comparison fixes what the loop must keep and asks how much rejection the rest will buy each way. Keep forty-five degrees of margin; the hold’s half clock is unavoidable on both routes; what is left — ninety, less forty-five, less 180 r180\,r — can be spent on lengthening the pulse or on poles after the hold, and the poles may be any number, placed anywhere.

Keeping 45° of margin at 5% of the clock, a pulse of 5 rectangles puts the image 128 dB down and the best equal poles 67. computed by solving, not by drawing. How far below the signal the nearest image can be put by a loop that keeps 45 degrees of phase margin, against its crossover as a fraction of the sample rate. Ninety degrees less the margin less the hold's half clock is the budget. Spent on lengthening the pulse (marks, the pulse's length in rectangles beside each), it buys the whole number of rectangles that fit, each adding 20 log((1 − r)/r) dB; spent on equal real poles after the hold (line), it buys what the best count and placement of them can, searched over every count. At 5% of the clock: 5 rectangles, 127.9 dB, against 6 poles and 67.2; at 10%, 2 rectangles and 38.2 against 2 poles and 33.7. The best poles do not sit at the crossover but near 0.48 of the clock, between the band and its image.
Fig. 4 How far below the signal the nearest image can be put by a loop keeping 45° of margin, against its crossover: by the longest pulse that fits (marks, the pulse’s length beside each), and by the hold followed by the best number and placement of equal poles, searched. At 5% of the clock five rectangles give 127.9 dB and six poles 67.2; at 10%, two rectangles 38.2 and two poles 33.7.

At 5 per cent of the clock the budget holds a pulse of five rectangles, which puts the image 127.9 dB below the signal. The best arrangement of equal poles the same budget allows is six poles, and it reaches 67.2 dB. At a sixteenth of the clock the budget holds the cubic exactly, for 94.1 dB, against 54.1 from five poles; at 3 per cent, eight rectangles and 241.5 dB against eleven poles and 108.2. Where three rectangles or more fit, the pulse buys between two-fifths more and more than twice as much as the poles. At a tenth of the clock, where only the straight line fits, the two are close — 38.2 against 33.7 dB — and at an eighth the straight line’s 33.8 beats a single pole’s 25.9.

The margin kept does not change the ranking. Keeping thirty degrees at 5 per cent of the clock buys six rectangles and 153.5 dB, against 84.5 from nine poles; keeping sixty buys three rectangles and 76.7, against 49.7 from four. The ranking does not depend on the margin chosen.

Where the best poles go

The search also says where the poles should be, and it is not where the matched pole sat. The best equal poles for a fixed phase budget sit close to half the clock — 0.476 at a 5 per cent crossover, 0.42 to 0.53 across most of the figure — well above the band and well below the image. Each then lags only a few degrees at the crossover and still attenuates the image substantially, because the image is twice as far above it as it is above the crossover.

That is why the matched pole was the wrong pole to compare with in a loop. Matching each pole to a sinc’s rejection forces it to the crossover, where its phase is most expensive; spreading the same phase across several higher poles buys more rejection for it. Even so, the pulse wins, and the reason is the identity every one of these comparisons has turned on: a rectangle’s rejection is a fixed distance ratio of (1−r)/r(1 - r)/r per half clock, which for a slow loop is a very large ratio bought with a very small phase, while a pole’s is capped by how far from the crossover the phase budget lets it sit. The slower the loop, the larger that advantage, and at 3 per cent of the clock it is a factor of more than two in decibels.

Four sincs, measured

The rejection figures rest on each rectangle adding exactly 20log⁡((1−r)/r)20\log((1 - r)/r). That is a statement about transforms and it is worth checking on the waveforms a converter actually emits.

Measured on the converter's own output, the cubic leaves the image 102.3 dB below the signal at 5% of the clock — four sincs exactly. computed by solving, not by drawing. The nearest image's level below the signal, read from the transform of each pulse's own output waveform over twenty clocks, for pulses of one to four rectangles at crossovers of 5% and 10% of the clock: hold at r = 0.05 25.6 dB, straight line at r = 0.05 51.1 dB, quadratic at r = 0.05 76.7 dB, cubic at r = 0.05 102.3 dB, hold at r = 0.1 19.1 dB, straight line at r = 0.1 38.2 dB, quadratic at r = 0.1 57.3 dB, cubic at r = 0.1 76.3 dB. Each is n·20 log((1 − r)/r) to a thousandth of a decibel: every rectangle adds the same distance ratio, whatever came before it.
Fig. 5 The nearest image below the signal, read from each pulse’s own output waveform over twenty clocks, for pulses of one to four rectangles at crossovers of 5% and 10% of the clock: 25.6, 51.1, 76.7 and 102.3 dB at 5%, and 19.1, 38.2, 57.3 and 76.3 dB at 10%.

Read from the transform of each output, the hold leaves the image 25.6 dB below a signal at a twentieth of the clock, and each further rectangle adds the same 25.6: 51.1 for the straight line, 76.7 for the quadratic, 102.3 for the cubic, each to a thousandth of a decibel of nn times the distance ratio. At a tenth of the clock the step is 19.1 dB and the cubic reaches 76.3. One knob, and the two exponents it turns found the hold’s image rejection growing with the oversampling ratio; here the same ratio, seen from inside a loop, is the crossover, and the pulse’s length multiplies it.

A motion loop, worked

A motor drive clocked at 20 kHz with a current loop crossing over at 1 kHz runs at a twentieth of its clock. Its converter — a pulse-width modulator’s average, or a digital-to-analogue converter driving a linear amplifier — would put an image near 19 kHz into the winding, which is audible and heats the copper. Held, that image is 25.6 dB below the signal; with a straight-line output 51.1; with the quadratic pulse 76.7, at an overshoot of 2.9 per cent; with the cubic 102.3, at 13.6.

If the specification is sixty decibels the quadratic pulse meets it with nearly the whole margin intact, a clock and a half of delay at 20 kHz being 75 µs. Meeting it with poles after a hold means 34 dB more from the filter; the best equal poles for a forty-five-degree loop at this crossover reach 67.2 dB in total, so they can, but six of them near 10 kHz is an analogue filter of sixth order whose tolerance, temperature drift and component count a pulse does not have. A pulse is arithmetic in the converter’s own logic, and it drifts with nothing.

A loop clocked ten times faster than its crossover has a different answer. At a tenth of the clock only the straight line fits a forty-five-degree margin, it gives 38.2 dB, and two well-placed poles give nearly the same. Such a loop, if it needs more rejection, needs a faster clock more than it needs either.

What a designer should take

Count reconstruction against the margin, not against the filter it replaces. An integrator loop has ninety degrees; a pulse of nn rectangles spends 180 n r180\,n\,r of them. The longest pulse a loop can afford while keeping a margin ϕm\phi_m is n=(90−ϕm)/(180 r)n = (90 - \phi_m)/(180\,r) rectangles, rounded down: four — the cubic — at a sixteenth of the clock for forty-five degrees, two at an eighth.

Never match analogue poles one for one to the sincs a long pulse would supply: they sit at the crossover, and three of them leave no margin at any speed. If poles must be used, place them near half the clock and use several; where a pulse of three rectangles or more would fit, they will buy between about half and three-quarters of what it would.

And trust the phase estimate more for long pulses than for short ones. The forty-five-degree points of the straight line, the quadratic and the cubic all overshoot about 26 per cent when marched, because the longer the pulse the slower the loop at which it reaches that margin. Two measurements of one margin is why the step is still the measurement to believe, and what is left at crossover is how a margin is read when a loop can be cut.

How the loops were marched

The loop is marched in units of clocks. At each clock edge the controller takes the plant’s output and the converter’s next sample is one minus it; the converter’s output inside each clock is the sum of the last nn samples’ B-spline pulses, evaluated only within the clock it belongs to, since the next sample has not been taken. The plant integrates at a gain putting the continuous crossover at rr of the clock; when poles are present, the converter’s output passes through a cascade of them first. Integration is fourth-order Runge–Kutta at eighty steps a clock for at least forty clocks and eight loop time constants, and the cascade integrator is checked against the single-pole one on the straight line before it is trusted with three poles. A loop is called unsettled when its last sixth swings more than its first. The best poles are searched over every count from one to four hundred, each at the corner that spends an equal share of the budget at the crossover. Images are read from twenty-clock records of each output at 256 points a clock.

What it leaves out

Filters other than equal real poles. A Butterworth or Bessel filter of the same order places complex poles and spends its phase differently; a Bessel filter is designed to have the flattest delay, which is exactly the quantity a loop counts. The comparison here is against the simplest analogue filter of each order, and a better one would close part of the gap. Whether it closes all of it is a calculation on the same budget.

Plants that are not integrators. A plant with its own pole near the crossover already spends some of the ninety degrees, so every pulse fits at a slower loop than drawn. The ranking per unit of phase is unaffected, since it does not involve the plant.

A mechanical resonance. The image is not the only thing a motion loop wants attenuated between its crossover and its clock; a structural mode often matters more, and a pole near it attenuates the mode while a pulse attenuates mainly near the clock’s multiples. That trade is not drawn here.

Still open: the delay-flat filter, the resonance between, and the pulse that is not a spline

A Bessel filter against the pulse. A Bessel filter is the analogue filter whose phase is most nearly a pure delay, so in a loop it should behave most like a pulse of the same delay. Matching its order and delay to the cubic’s two clocks and comparing the image each leaves would say whether a pulse is better than any analogue filter of equal delay or only better than equal real poles.

A resonance between the crossover and the clock. A two-mass plant with a mode at, say, a third of the clock is the case a motion loop’s designer actually meets. A pulse’s attenuation at a third of the clock is a few sincs’ worth; a pole placed at the mode attenuates it far more. Where the mode is, relative to the clock and the crossover, decides which reconstruction protects the mechanism better, and the marched two-mass loop would draw the boundary.

A pulse designed for the loop. The B-splines are one family; a converter can emit any pulse it can compute. A pulse that puts zeros on the image’s band while keeping its delay shorter than a spline of equal rejection — trading the spline’s smoothness for less delay — would move the longest-pulse boundary, and the question is how far below n/2n/2 clocks the delay can be pushed for nn sincs’ worth of rejection.

Part 8 on reconstruction

One argument about Reconstruction, and one of 8 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.

Anti imaging filterDesign tradeoffFilter orderLoop gainPhase marginReconstructionZero-order hold