The memory a wandering drift asks for
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 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, , 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.
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 . Each cycle its output moves towards the input by a fraction 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 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 . With a pole at , the error between the averager’s output and the input obeys a one-line recursion, , where is the input’s step and the switch noise. That is exact, and so is the stationary variance it gives:
The first term is the wander the average cannot follow, and it grows with the memory: an average over cycles answers with where the input was, on average, over the last , and a walk has moved about 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 , smallest at
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 , and its minimum fell where the noise term was twice the lag term. Here both terms are noises, one rising as and the other falling as , and the minimum of 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.
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 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 ; for a walk it is the rms step . At each drift, the best memory is located on the exact closed form for both.
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 in cycles, so its cost rises as the square of the memory in variance; a walk travels about , 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 , 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.
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 ; a ramp moves in the same time; the two are equal at , 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 . 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 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 — an exponential average with a fixed gain . The leaky integrator is that filter, with . Its optimum memory, minimising the error variance over , is the Kalman gain, so at 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 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 , 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 , from which the noise is , the lag , and the unfollowed wander with the partial sums of . 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 and , with and , derived from its impulse response ; 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 but slower than — 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 a cycle, through switch noise of a cycle, is best at a memory of 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 , 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 with between a half and one, and the best memory as a power of between the walk’s and the ramp’s. Locating that exponent against , 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
- One step of dither per moment closed form, design tradeoff, seeded generator
- The amplifier inside the sample design tradeoff, kt/c noise, switched-capacitor
- The dither that is a decision closed form, design tradeoff, seeded generator
- The noise that was already a dither closed form, design tradeoff, seeded generator
- The offset that knows the signal kt/c noise, sampled data, switched-capacitor
- The average the noisy parts rule design tradeoff, seeded generator