The floor, which bounds from below

The memory a wandering drift asks for

A switched-capacitor averager with a leak built in follows a steady drift best at a memory set by a cube root, and at that memory its noise is twice its lag. Give it an input that wanders instead — a normal step of 1 µV rms each cycle, as a reference does whose temperature follows the room — and the best memory is 127 cycles, not 16.5: the switch noise of 127 µV a cycle over the step, a square root in the two variances, where the noise and the unfollowed wander contribute equally. A walk asks for a longer memory than a ramp of the same step at every drift, because it moves only √N steps in N cycles. Put both drifts on one input and the best memory stays at the walk's until the steady drift reaches about 2.6 nV a cycle on a 0.1 µV wander, then falls on the ramp's law. And the plain leaky average is then the optimal filter, the steady state of a Kalman filter: a double average that follows a ramp with no lag is 5.7% worse on a pure walk and better only once the steady drift passes 1.1 nV a cycle.

Assumes: The total that has no resistor in it · A resistor made of a clock

The leak worth building in gave a switched-capacitor integrator a deliberate leak — a damping capacitor that samples the output each cycle and discharges it — and turned it into an exponential average with a memory of Cf/CdC_f/C_d cycles. Fed an input drifting steadily, 1 µV a cycle through a 1 pF sampling capacitor, it found that too short a memory passes the switch noise and too long a memory lags the drift, and that the best memory sits between at 16.5 cycles. The optimum followed a cube-root law, N∗=(kT/(Csr2))1/3N^* = (kT/(C_s r^2))^{1/3}, and at it the noise variance was exactly twice the squared lag.

A steady ramp is the simplest drift there is, and that essay said so. A reference whose temperature follows the room, or a sensor whose bias wanders, is not drifting in a straight line; it moves a little each cycle in a direction that has nothing to do with the last. The model for that is a random walk, and the essay ended by naming it as the next question: the optimum would then balance two noises, where the ramp balanced a noise against a lag, and the law should change. It does, and the change says something about which averager to build.

An input that wanders 1 µV a cycle at random, averaged by the 1 pF leaky averager: the best memory is 127 cycles, for 11.2 µV — where a steady drift of 1 µV a cycle asked for 16.5computed by solving, not by drawing, and seeded. The unity-gain switched-capacitor averager of 1 pF, its memory set by the feedback capacitor, fed an input that takes a normal step of 1 µV rms each cycle. The rms error (solid) is the wander the average cannot follow (dashed), a²σw²/(1 − a²), and the switch noise it passes (dotted), (1 − a)²σv²/(1 − a²) with σv = 127 µV a cycle, together; seeded marches of 240,000 cycles (dots) agree to 8%, the sampling error of an rms over a few hundred memories. The best memory is 127.1 cycles against σv/σw = 126.6, with 11.2 µV of error, 7.92 µV of it wander and 7.95 µV noise — equal shares. A ramp of the same 1 µV a cycle wanted 16.5 cycles, because a walk covers only √N steps in N cycles.10µ100µ1m1101001k10kmemory of the average (cycles)rms error against the wandering input (volts)total11.2 µV at bestwander not followedgrows as √ memoryswitch noisefalls as √ of itbest memory127 cyclessolved, then checked — closed form and seeded marchwander against noise
Fig. 1 The unity-gain 1 pF averager fed an input that takes a normal step of 1 µV rms each cycle. The rms error (solid) is the wander the average cannot follow (dashed) and the switch noise it passes (dotted), with seeded marches of 240,000 cycles (dots). The best memory is 127 cycles, for 11.2 µV of error — 7.92 µV of wander and 7.95 µV of noise, equal shares. A ramp of 1 µV a cycle wanted 16.5.

The averager and the walk

The averager is the earlier one exactly: a 1 pF sampling capacitor, an equal damping capacitor so that its gain is one, and a feedback capacitor that sets the memory N=Cf/CdN = C_f/C_d. Each cycle its output moves towards the input by a fraction 1/N1/N of the difference, and both switched capacitors leave a kT/C sample of charge behind. Referred to the input, the two together are a white noise of variance σv2=4kT/Cs\sigma_v^2 = 4kT/C_s a cycle, 127 µV rms for 1 pF at 290 K — the sampling noise of the noise a clock does not make, doubled because the leak samples as much as the input does.

The input now takes a step each cycle, drawn from a normal distribution of standard deviation σw\sigma_w. With a pole at a=1−1/Na = 1 - 1/N, the error between the averager’s output and the input obeys a one-line recursion, e[n]=a e[n−1]+a w[n]−(1−a) v[n]e[n] = a\,e[n-1] + a\,w[n] - (1 - a)\,v[n], where ww is the input’s step and vv the switch noise. That is exact, and so is the stationary variance it gives:

σe2=a2σw2+(1−a)2σv21−a2.\sigma_e^2 = \frac{a^2\sigma_w^2 + (1 - a)^2\sigma_v^2}{1 - a^2}.

The first term is the wander the average cannot follow, and it grows with the memory: an average over NN cycles answers with where the input was, on average, over the last NN, and a walk has moved about N/2\sqrt{N/2} steps from there. The second is the switch noise the average passes, and it falls with the memory as the earlier essay found. For long memories the sum is Nσw2/2+σv2/(2N)N\sigma_w^2/2 + \sigma_v^2/(2N), smallest at

N∗=σvσw.N^* = \frac{\sigma_v}{\sigma_w}.

Two noises, balanced

The first figure plots the error against the memory for a wander of 1 µV a cycle. On the exact closed form the best memory is 127.1 cycles against the law’s 126.6, and the error there is 11.2 µV. The seeded marches, two hundred and forty thousand cycles each at four memories, agree with the closed form to within eight per cent, which is the sampling error of an rms over a few hundred independent memories: a walk’s error is correlated over a whole memory, so a long march holds fewer independent samples of it than its length suggests.

The balance at the optimum is the first difference from the ramp. With a ramp, the squared error was N2r2+2kT/(NCs)N^2r^2 + 2kT/(NC_s), and its minimum fell where the noise term was twice the lag term. Here both terms are noises, one rising as NN and the other falling as 1/N1/N, and the minimum of αN+β/N\alpha N + \beta/N is where the two are equal. At 1 µV a cycle the unfollowed wander is 7.92 µV rms and the switch noise 7.95 µV. The rule for checking a running averager therefore depends on the drift’s character. Against a steady drift, an averager whose lag is about 0.58 of its error is well set; against a wandering one, an averager whose output’s departures from the input are half switch noise and half missed turns is.

That can be read off a recording. The switch noise is fast — it changes from one cycle to the next — and the missed wander is slow, correlated over the memory, so the two halves of the error separate in a spectrum: one flat, one concentrated below the averager’s corner.

One seeded stretch

The second figure is one stretch of the walk, fifteen hundred cycles of 1 µV steps drawn from a fixed seed, averaged at three memories on the same switch-noise draws.

One seeded stretch of an input wandering 1 µV a cycle, averaged with memories of 15, 129, 1000 cycles: after the first 500 cycles the errors are 25.3 µV, 7.19 µV, 9.93 µV. Seeded: an input taking a normal step of 1 µV rms each cycle (thin line), and the unity-gain 1 pF averager with memories of 15, 129, 1000 cycles on the same switch-noise draws. From cycle 500 on, the rms errors are 25.3 µV, 7.19 µV, 9.93 µV. The short memory follows every turn and carries the switch noise with it; the long one is smooth and misses the turns, answering with where the path was over the last thousand cycles; the middle one, at σv/σw = 129, is the closest. A walk has no lag in the sense a ramp has — the average is not behind in one direction — and its cost is an error that changes sign as the path does.
Fig. 2 An input wandering 1 µV rms a cycle (thin line), seeded, and the 1 pF averager at memories of 15, 129 and 1,000 cycles on the same switch noise. From cycle 500 on, the rms errors are 25.3, 7.19 and 9.93 µV. The short memory follows every turn and the noise with it; the long one is smooth and answers with where the path was over the last thousand cycles.

The fifteen-cycle average follows every turn of the walk and carries the switch noise with it, 25.3 µV of error. The thousand-cycle average is smooth and misses the turns: where the walk reverses, it keeps going for a while, and where it runs in one direction for a few hundred cycles, it falls behind. That is not a lag in the ramp’s sense, because a walk has no persistent direction to lag behind, and the error changes sign as the path does. The 129-cycle average is close to the best memory for this wander and does best, 7.19 µV on this stretch.

The long memory’s error is 9.93 µV, not much worse than the best, and that is characteristic of the walk’s optimum. Near N∗N^* the error grows only as the square root of the factor by which the memory is wrong, and both terms are noises that grow and shrink slowly. A ramp punished an over-long memory more, since its lag is linear in the memory and adds to the error in one direction.

A square root against a cube root

The third figure puts the two laws on one axis. For a ramp the drift per cycle is the ramp’s step rr; for a walk it is the rms step σw\sigma_w. At each drift, the best memory is located on the exact closed form for both.

The best memory against the drift per cycle: a slope of −1 for a wandering input and −2/3 for a steady one, 127 cycles against 16.5 at 1 µV a cycle. computed by solving, not by drawing. For the unity-gain 1 pF averager, the memory that minimises the rms error, located on the exact closed forms (dots), for an input that random-walks with an rms step σw a cycle (solid) and for one that ramps r a cycle (dashed); lines σv/σw and (kT/(Cs·r²))^(1/3). 0.010 µV: 12655.8 and 342.8; 0.032 µV: 4002.4 and 159.5; 0.10 µV: 1266.0 and 74.4; 0.32 µV: 400.7 and 34.9; 1.0 µV: 127.1 and 16.5; 3.2 µV: 40.5 and 8.0; 10 µV: 13.2 and 4.1; 32 µV: 4.5 and 2.3; 100 µV: 1.9 and 1.4. Slopes −1.000 and −0.665. A walk asks for a longer memory than a ramp of the same step at every drift drawn, by a factor that grows as the drift falls: a walk moves √N steps in N cycles, so it costs a long memory less.
Fig. 3 The best memory against the drift per cycle, located on the exact closed forms (dots), for an input that random-walks with rms step σw\sigma_w (solid, σv/σw\sigma_v/\sigma_w) and one that ramps rr a cycle (dashed, the cube-root law). At 1 µV a cycle, 127 cycles against 16.5; at 10 nV, 12,656 against 343. Slopes −1.000 and −0.665.

The walk’s law has a slope of −1, the ramp’s of −2/3, and the walk asks for the longer memory at every drift drawn: 127 cycles against 16.5 at 1 µV, 12,656 against 343 at 10 nV. The reason is the square root in a walk’s displacement. A ramp travels NrNr in NN cycles, so its cost rises as the square of the memory in variance; a walk travels about Nσw\sqrt{N}\sigma_w, so its cost rises only as the memory. A drift that does not know where it is going is cheaper to average over, and the cheaper it is, the longer the best memory.

In capacitor terms the two laws are very different designs. At unity gain the memory is Cf/CsC_f/C_s, so at 1 µV a cycle a ramp asks for a feedback capacitor of 16.5 pF and a walk for 127 pF. At 10 nV a cycle the walk asks for 12.7 nF, which is not a capacitor anyone would integrate; a memory that long would be built as a digital average after a converter, with the switched-capacitor stage doing what it does well, the first few cycles.

Both drifts at once

A real reference does both. It has a slow steady trend — ageing, a warming enclosure — and a wander on top. The earlier essay asked at what ratio of steady drift to random wandering one law gives way to the other. The fourth figure answers it for a wander of 0.1 µV a cycle, with a steady drift added from 0.1 nV to 10 µV a cycle.

A steady drift on top of a 0.1 µV wander: the best memory holds at the walk's 1266 cycles until the drift reaches about 2.6 nV a cycle, then falls on the ramp's cube-root law. computed by solving, not by drawing. The best memory of the 1 pF averager for an input that random-walks 0.1 µV rms a cycle and also ramps r a cycle, located on the exact closed form (dots), against the walk's law σv/σw = 1266 cycles (dashed) and the ramp's cube-root law (dotted). 0.1 nV: 1263, 0.18 nV: 1256, 0.32 nV: 1236, 0.56 nV: 1181, 1 nV: 1061, 1.8 nV: 873, 3.2 nV: 663, 5.6 nV: 478, 10 nV: 335, 18 nV: 231, 32 nV: 159, 56 nV: 109, 100 nV: 74, 180 nV: 51, 320 nV: 35, 560 nV: 24, 1000 nV: 17, 1800 nV: 11, 3200 nV: 8, 5600 nV: 6, 10000 nV: 4 cycles. The two laws hand over where, at the best memory, the ramp's squared lag equals the wander's share: 2.62 nV a cycle, against σw/√(2σv/σw) = 1.99 nV, the drift that moves as far over the walk's best memory as the walk spreads over it.
Fig. 4 The best memory for an input wandering 0.1 µV rms a cycle and also ramping rr a cycle, on the exact closed form (dots), against the walk’s law, 1,266 cycles (dashed), and the ramp’s cube root (dotted). The memory holds near the walk’s until the steady drift reaches about 2.6 nV a cycle and then falls on the ramp’s law: 335 cycles at 10 nV, 17 at 1 µV.

The best memory stays at the walk’s 1,266 cycles while the steady drift is a fraction of a nanovolt a cycle, bends near 2.6 nV, and from there follows the ramp’s cube root: 335 cycles at 10 nV a cycle and 17 at 1 µV, where the ramp alone asked for 16.5. The handover has a simple reading. At the walk’s best memory the walk has spread by about σwN∗/2\sigma_w\sqrt{N^*/2}; a ramp moves N∗rN^*r in the same time; the two are equal at r=σw/2N∗r = \sigma_w/\sqrt{2N^*}, which is 1.99 nV a cycle here against the measured 2.62. The handover is gradual, over about a decade either side, so the estimate is the place to start and the exact closed form the place to finish.

The handover scales as σw3/2\sigma_w^{3/2}. A wander ten times larger moves it up by a factor of about 32, to 83 nV a cycle at a 1 µV wander. So the rule for a real reference is a comparison between two numbers that are both measurable from a long recording: the slope of a straight line fitted to it, and the spread of its cycle-to-cycle steps. A slope well below σw/2σv/σw\sigma_w/\sqrt{2\sigma_v/\sigma_w} means the walk’s law; well above it, the ramp’s.

A reference, in numbers

A worked case shows which regime a real circuit lands in. Take a converter’s 2.5 V reference sampled at 10 kHz through the 1 pF averager, and suppose a long recording of its cycle-to-cycle steps shows a wander of 0.3 µV rms a cycle. The best memory is then 422 cycles, 42 ms, and the averager’s error 6.16 µV. Now add a steady trend: an enclosure warming by one kelvin over ten minutes, on a reference with a coefficient of 5 ppm/K, moves it 12.5 µV in 600 s, about 0.002 nV a cycle at 10 kHz. The handover for a 0.3 µV wander is near 14 nV a cycle, so the trend is four orders of magnitude below it, and the walk’s law governs completely. Ageing, at tens of parts per million over a thousand hours, is slower still.

The conclusion generalises: at sample rates of kilohertz and above, thermal and ageing trends are tiny per cycle, and a reference’s wander decides the memory. The cube-root law of the steady ramp applies where the clock is slow or the trend is steep — a sensor sampled once a second through a warm-up, a bias settling after power is applied. That is why the ramp was the right model for the slow, steady drift between recalibrations that the leak worth building in had in mind, and the walk the right one cycle to cycle.

It also says where the averaging should happen. Forty-two milliseconds of memory at unity gain is a 422 pF feedback capacitor, possible but large, and its kT/C — the total that has no resistor in it in sampled form — is what sets the 6.16 µV. Averaging the first few cycles in the switched-capacitor stage and the rest digitally, after the converter, keeps the capacitor small; the samples it passes on are then not independent, which is the correction the average that is not N times quieter made, and the digital average’s own memory is chosen against the walk on the same law. Both stages are windows on one correlation structure, and the window the square-root law has is the general form of the trade.

The leaky average is optimal for a walk

There is a stronger statement available for the walk, and it changes what the averager is. An input that random-walks, observed through white noise, is the textbook case of a Kalman filter, and the steady state of that filter is a recursion of the form x^[n]=x^[n−1]+K(z[n]−x^[n−1])\hat x[n] = \hat x[n-1] + K(z[n] - \hat x[n-1]) — an exponential average with a fixed gain KK. The leaky integrator is that filter, with K=1/NK = 1/N. Its optimum memory, minimising the error variance over NN, is the Kalman gain, so at N∗N^* the leaky average is not merely the best exponential average: it is the best linear estimator of a random walk in white noise, of any form.

Against a ramp it was not. A ramp has a persistent slope, and a filter that estimates the slope as well as the level can follow it with no lag at all. The simplest such filter is Brown’s double exponential average: average once, average the result again with the same memory, and report twice the first less the second. Its impulse response sums to one, and its first moment, the lag, is exactly zero. It pays for that with noise, because it weights recent samples more heavily.

The plain leaky average against a lag-free double one, each at its best memory, on a 0.1 µV wander plus a steady drift: the plain one wins until the drift reaches 1.1 nV a cycle — 1.057 times better with no drift at all. computed by solving, not by drawing, by impulse-response sums: noise σv²·Σh², wander σw²·Σ(1 − Hⱼ)², lag r·Σk·hₖ, with the switch noise referred to the input and the second average assumed noiseless. The plain exponential average (solid) and Brown's double exponential 2S₁ − S₂ (dashed), which follows a ramp with no lag, each at the memory that is best for it, on an input wandering 0.1 µV rms a cycle plus a ramp r. 0.1 nV: 3.56 µV and 3.76 µV; 0.2 nV: 3.57 µV and 3.76 µV; 0.4 nV: 3.59 µV and 3.76 µV; 0.79 nV: 3.68 µV and 3.76 µV; 1.6 nV: 3.93 µV and 3.76 µV; 3.2 nV: 4.45 µV and 3.76 µV; 6.3 nV: 5.3 µV and 3.76 µV; 13 nV: 6.51 µV and 3.76 µV; 25 nV: 8.1 µV and 3.76 µV; 50 nV: 10.2 µV and 3.76 µV; 100 nV: 12.8 µV and 3.76 µV; 200 nV: 16 µV and 3.76 µV; 400 nV: 20.1 µV and 3.76 µV; 790 nV: 25.2 µV and 3.76 µV; 1600 nV: 31.6 µV and 3.76 µV; 3200 nV: 39.5 µV and 3.76 µV; 6300 nV: 49 µV and 3.76 µV. With no steady drift the plain average is the optimal filter for a random walk in white noise — it is the Kalman filter's steady state — and the double one pays for a trend it does not need. They cross at 1.07 nV a cycle.
Fig. 5 The plain leaky average (solid) and Brown’s lag-free double average 2S1−S22S_1 - S_2 (dashed), each at the memory that is best for it, on a 0.1 µV wander plus a steady drift, by impulse-response sums with the switch noise referred to the input. With no steady drift, 3.56 µV against 3.76: the plain average is 5.7% better. They cross at 1.07 nV a cycle, and at 1 µV a cycle the double average’s 3.76 µV beats the plain one’s 25.2.

The fifth figure prices both, each at its own best memory. With no steady drift, the plain average reaches 3.56 µV and the double one 3.76 µV, 5.7% worse, a ratio independent of the wander’s size; the double average spends noise on a trend that is not there. Add a steady drift and the plain average’s error rises with it, since it lags, while the double average’s does not move. They cross at 1.07 nV a cycle on a 0.1 µV wander, at 5.6 nV on a 0.3 µV one, and at 34 nV on a 1 µV one. Above the crossing the double average wins, and by a growing margin: at 1 µV a cycle of steady drift it is 3.76 µV against 25.2.

So the choice of averager follows from the same comparison as the choice of memory. A drift that is mostly wander wants the plain leaky average at N∗=σv/σwN^* = \sigma_v/\sigma_w, which is optimal; a drift with a real trend wants a filter that tracks the trend, and the leaky average’s cube-root law is then the price of having built the wrong filter rather than a property of the input.

Two routes to each number

The plain average’s error is the exact stationary variance of its recursion, and it is checked twice: against seeded marches of the averager itself, with both switches’ charges drawn every cycle, at four memories; and against a second, independent route — the averager’s impulse response hh, from which the noise is σv2∑hk2\sigma_v^2\sum h_k^2, the lag r∑k hkr\sum k\,h_k, and the unfollowed wander σw2∑j(1−Hj)2\sigma_w^2\sum_j (1 - H_j)^2 with HjH_j the partial sums of hh. At memories of 10, 100 and 1,000 cycles the two routes agree to a part in ten thousand.

Brown’s average has the closed forms ∑hk2=4b2/(1−x)−4b3/(1−x)2+b4(1+x)/(1−x)3\sum h_k^2 = 4b^2/(1 - x) - 4b^3/(1 - x)^2 + b^4(1 + x)/(1 - x)^3 and ∑j(1−Hj)2=x/(1−x)−2bx/(1−x)2+b2x(1+x)/(1−x)3\sum_j (1 - H_j)^2 = x/(1 - x) - 2bx/(1 - x)^2 + b^2x(1 + x)/(1 - x)^3, with b=1/Nb = 1/N and x=(1−b)2x = (1 - b)^2, derived from its impulse response hk=2b ak−b2(k+1)akh_k = 2b\,a^k - b^2(k + 1)a^k; they are checked against the impulse-response sums at the same three memories, and its lag is checked to be zero. The best memories are located by golden-section search on the exact forms, and the handover by bisection on where the ramp’s share of the error equals the walk’s.

What the walk leaves out

The double average is drawn without its own noise. Built as a second switched-capacitor stage, it would add its own kT/C, which makes it worse than drawn; built digitally after a converter, it adds the converter’s quantisation, which is usually smaller. Either way the crossing moves up, and the plain average’s territory grows.

The wander is white in its steps. A real reference’s wander often has a flicker character, steps correlated over long times, and its displacement then grows faster than N\sqrt{N} but slower than NN — between the walk and the ramp. The best memory for such a drift follows a law between the two exponents here, and it is not a single number. The corner where averaging stops working is where that kind of noise was measured against an average.

And the switch noise is white too. The averager’s own amplifier adds a flicker floor of its own, which the average an integrator can hold capped with a finite gain. At memories of thousands of cycles that cap matters, since the deliberate leak and the amplifier’s leak combine.

The number worth carrying

An exponential averager following an input that wanders by σw\sigma_w a cycle, through switch noise of σv\sigma_v a cycle, is best at a memory of σv/σw\sigma_v/\sigma_w cycles, where its noise and its missed wander are equal: 127 cycles and 11.2 µV for a 1 pF averager on a 1 µV wander, against 16.5 cycles for a ramp of the same step. The two laws hand over near r=σw/2N∗r = \sigma_w/\sqrt{2N^*}, about 2.6 nV a cycle on a 0.1 µV wander. Below that the leaky average is the optimal filter, 5.7% better than a lag-free double average; above it, the trend is worth following, and the double average wins.

Still open: an averager that measures its own drift, a flicker wander, and the energy per estimate

A memory chosen by the averager. The balance at the optimum is a measurable: equal fast and slow halves for a walk, two to one for a ramp. An averager that splits its own error into the two halves — by comparing short and long averages of its output — could adjust its memory towards the balance. Whether that loop converges to the optimum, and how fast it follows a reference whose wander changes with the room, is the adaptive version of this essay.

A wander whose steps are correlated. With a flicker-like wander the displacement grows as NγN^{\gamma} with γ\gamma between a half and one, and the best memory as a power of σv\sigma_v between the walk’s and the ramp’s. Locating that exponent against γ\gamma, and whether the leaky average is still close to optimal for it, would cover the drift that real references actually have.

The energy per estimate. Each cycle charges two capacitors, so an averager’s energy rises with its clock rate while its error depends on cycles of memory and on the drift per cycle, which falls as the clock rises. For a walk, the step per cycle falls as the square root of the clock period, so the best memory in cycles rises as the square root of the clock rate and its length in seconds falls as it, while the energy spent each second rises with the clock. The clock rate that minimises energy for a stated error is a number the sample that is subtracted would want for its own reference sample.

Part 8 on kT/C noise

One argument about kT/C noise, 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.

AveragingClosed formDesign tradeoffkT/C noiseSampled dataSeeded generatorSwitched-capacitor