The peak that is a corner
Assumes: The frequency a sample rate invents
The rate each reading needs found that eight samples a cycle hold a sine wave completely, four times what the Nyquist rate asks, and that the largest of them is still 7.61 per cent below the peak. The largest sample needs twenty-three samples a cycle to come within one per cent. It stated the reason in a sentence that is true and easy to over-read: the maximum of a smooth curve is flat, so the shortfall goes as the square of the sample interval. It then closed on the observation that the square belongs to a maximum with a continuous second derivative, and that many peaks on an oscilloscope do not have one.
That matters because the peak reading is the one instruments take most casually. A meter or a scope that reports the largest sample is making no assumption about the waveform, or appears not to be, and its specification states a rate. The rate it needs to reach a stated accuracy depends entirely on a property of the waveform that the instrument does not know, and the dependence is not a matter of a constant. Three common waveforms at sixteen samples a period, with the same period and the same peak, read 1.92 per cent, 12.5 per cent and exactly nothing short.
What counts as the worst
A reading taken from samples depends on where the samples happened to fall, and the fair measure of a rate is what it guarantees. So every shortfall here is taken over the sampling phase, the distance from the true peak to the nearest sample, which for an unsynchronised instrument takes every value between minus and plus half an interval with equal likelihood. The largest shortfall occurs at the midpoint, where two samples sit an equal distance either side of the peak; the smallest occurs when a sample lands exactly on it, where the reading is perfect at any rate. A claim about a rate is a claim about the midpoint.
That distinction has a useful side effect, and it is the first thing a sweep over the phase shows. A shortfall that depends on where the sample fell is a curve, and the curve is a portrait of the waveform at its peak.
The triangle’s curve is a V, the sine’s a parabola and the third curve stays near zero until the sample is nearly halfway to the next. Each is , where is the first power of time in which the waveform leaves its peak. Call that the order of the peak: a corner has order one, since its value falls in proportion to the time from it. A smooth maximum has order two. The third waveform, , has its second derivative vanish at the top as well, and leaves as : a flattened peak of order four, which is what a slightly over-driven stage with a soft limit looks like and a good approximation to many real flat-topped waves.
The curve also fixes something a specification sheet rarely separates, which is how far the average reading is from the worst one. A shortfall of averaged over the phase is of its worst value. So a triangle’s average reading is half as short as its worst, a sine’s a third and a flattened peak’s a fifth. Measured at sixteen samples a period these come out 0.500, 0.334 and 0.200. The reading a user sees most often therefore depends on the order too, and a sine and a triangle that disagree by a factor of 6.5 in the worst case disagree by a factor of 9.8 in the mean.
The law is the order
With the phase settled, the rate can be swept. Each curve below is the worst shortfall against samples per period, over four decades of error, and its slope needs no assumption to measure: it is the ratio of two worst shortfalls an octave apart.
The measured slopes are 1.000 for the triangle, 2.000 for the sine and 4.000 for the flattened peak, and at those exponents the fit has nothing to do: the shortfall is exactly a power of the interval at every rate on the figure. A decaying pulse whose peak is a cusp, an exponential falling away from a sharp top, has slope 0.986 by the top of the range, since its shape changes across the interval at low rates. That is how a real RC-discharged pulse behaves, and a sampled pulse from a first-order network is a corner.
The numbers that come from those slopes are not close to one another. For a peak to come within one per cent, a sine needs 23 samples a period, as the earlier essay found. A triangle needs 200, since a shortfall of reaches a hundredth only there. A pulse with a time constant of a tenth of its period needs about five hundred. So an instrument that quotes “one per cent at twenty-five samples a cycle” has quoted something about sine waves, and a triangular or sawtooth signal on the same instrument at the same rate reads eight per cent short. Nothing about the waveform’s frequency has changed.
The Nyquist rate has nothing to say about any of this, which is the same conclusion the rate each reading needs reached from another direction. The frequency a sample rate invents measured that boundary, and it is about what the samples determine. A triangle wave with a finite number of harmonics, sampled above twice the top one, is completely determined and its peak can be recovered exactly. It is just not in any sample.
A law with a threshold in it
The clipped sine is the odd one out, and it gets its own law. A sine limited at nine-tenths of its height is flat for 14.4 per cent of its period, since it exceeds 0.9 for that fraction of each cycle. Once the sample interval is shorter than the flat, a sample must land on the flat at every phase, and the largest sample is then the peak exactly. The threshold is at samples a period, and above that the shortfall is not small: it is zero, to the last digit.
At 4 samples a period it is 21.4 per cent, so the function falls from a substantial error to nothing at a definite rate. That is unlike any other reading on these figures, and it inverts the usual advice. A flat-topped pulse, the kind a limiter or a digital output makes, has a peak reading that is trivially exact at rates where a sine’s is several per cent out. A designer testing a peak-reading path with a clipped calibrator will see a flawless instrument. That instrument is 3.41 per cent short on a sine at twelve samples a period and 16.7 short on a triangle, and the calibrator did not ask.
The general statement follows from the three cases. A peak’s order is the number that describes how quickly the waveform leaves it, and increasing the order improves the law: 1, 2, 4 and then, in the limit of a flat top, the threshold. A flat top is the case where the order is infinite.
A corner is round if looked at closely enough
The order is not really a property of a waveform, and the figure that shows this is the one with the most practical content. No signal in a circuit has a true corner, since any path has a bandwidth. A triangle reaching an instrument through a stage with a finite number of harmonics has a corner rounded at a scale set by the period over its top harmonic.
So the truncated triangle tracks the ideal one at low rates, with its shortfall falling as , and then bends to the square law once the samples are close enough together to see the top as a parabola. The bend is where the sample interval reaches the width of the rounded region. Far above it the slope is 2.00 for all three truncations. A wave of 30 harmonics reads 2.35 per cent short at 64 samples a period and 0.0115 at 1,024, against 3.13 and 0.195 for the sharp corner. Four octaves of rate buy the sharp corner a factor of 16 and the rounded one a factor of 204.
The consequence is that the order of a peak is a statement about the peak at the size of the sample interval. A slow instrument looking at a wave that has been through a 10 MHz path sees a corner. A fast one looking at the same wave sees a round top. Both are correct, and their laws are both right, and the bandwidth of the path decides which applies at a given rate.
This is the same situation as the corner that says nothing about an edge, turned round: a bandwidth was too blunt a description there and here it is the thing that decides a law. It also says what a rate’s guarantee can really be stated against. The path’s bandwidth gives a fixed scale, so for a signal known to have passed through it the shortfall at rates above the bend cannot be worse than a square law with a constant set by that bandwidth. An instrument with its own front-end filter can state a law. One that does not know the path has only a bound of the kind.
What a parabola recovers
If a peak is flat at the top, the obvious repair is interpolation. Take the largest sample and its two neighbours, fit a parabola and report its vertex. That is cheap, it is built into several measurement instruments and spectrum analysers, and on a sine it is excellent.
On a sine it moves the error from the second power of the interval to the fourth. At 32 samples a period the largest sample is 0.482 per cent short and the vertex 0.00347 per cent out, a factor of 139 for three multiplications and a division. On a triangle at the same rate it moves 6.25 to 4.69, and the slope stays exactly 1.00. A parabola through a corner has its vertex at a fixed fraction of an interval from the true one, because the three points always sit on two straight lines, so it improves the constant by a quarter and buys no power of the rate at all.
The flattened peak is the interesting third case, since a flat top is a very smooth thing and would seem even better suited. It is not. At 32 samples a period the largest sample is 0.00232 per cent short and the vertex is 0.0206 per cent out, nearly nine times worse, with the slope unchanged at 4.00. A parabola through three points on a flat top has to have a vertex, and it finds one above the true peak, by reading the small difference between three nearly equal numbers as a curvature. The waveform has no second-order term for the fit to cancel, and the fit supplies one anyway.
So an interpolation is an assumption about the order of the peak, and its benefit is sharp: it pays out in full at the one order it assumes and is a modest correction everywhere else. An instrument doing this silently is therefore far more accurate on a sine than on anything else, and its accuracy claim on a sine says less about an arbitrary signal than the plain largest-sample reading does. A sinc reconstruction, the exact answer an exact answer to a different question measured, assumes only a bandwidth, and that is a much better assumption about a signal whose shape is unknown, though it costs a very much longer sum.
A bit’s worth of a peak
A peak reading has a counterpart in converter language. An eight-bit resolution reading a full-scale peak has a step of 0.39 per cent of the peak, and a sampling shortfall the same size is a bit’s worth of the converter thrown away. Six decibels a bit measures that step against a waveform; the sine reaches a shortfall that small at thirty-six samples a period, while a triangle needs 512. An instrument that digitises at a resolution finer than the sampling law can support is reporting bits that the rate has already lost, and this happens on anything sharper than a sine at the rates scopes usually run.
The record length does not help. A long record of a periodic waveform at an unsynchronised rate does land a sample close to the peak eventually, and a peak-hold over many cycles will drift upward towards the true value, as the cycle a converter has to know discusses for periodic signals. That is a different instrument: it is averaging over phase by waiting, and it relies on the waveform repeating and on the clocks being incommensurate. On a single transient, the phase is what it is and the worst case is the case to design for.
The rate, read backwards
There is also a measurement the law makes possible rather than a limit it imposes. Sample a repeating waveform at two rates an octave apart, and the ratio of the two shortfalls against a long-run peak-hold gives the slope directly: a ratio of 2 is a corner, 4 a round peak, 16 a flattened one. So the order of a peak can be measured by a peak meter that has two clock settings, without looking at the waveform. Whether it is a corner to this instrument is then a thing it can say, and with it the instrument can say which of its peak accuracies applies. Nobody quotes the number, but it would be a good one to have on a test report, since it is the thing that decides whether a reading from one rate can be trusted at the next.
What the shapes leave out
The waveforms here are ideal functions, sampled instantly and exactly on a uniform clock. No noise is on the samples, and that matters more than it first appears, because a shortfall of a tenth of a per cent is small compared with the noise on many readings; a largest-of-N reading in the presence of noise is biased upward, by an amount that grows with how many samples lie near the peak, so the noise and the shortfall have opposite signs and a stated noise level has a rate at which they cancel. That is left open below.
Aperture is ignored as well. A real sampler averages the waveform over a short window, and on a corner that window itself clips the peak by a fixed amount regardless of the rate. That window is a filter with the droop any hold has, and on a corner it would add a floor below which the law cannot go.
What to carry away
A peak’s order is the power of time with which the waveform leaves it, and the largest sample’s worst shortfall falls as the rate to that power: 12.5 per cent for a triangle at sixteen samples a period, 1.92 for a sine and 0.0369 for a flattened peak; the mean is of the worst. A flat top reads exactly above a definite rate, seven samples a period for a sine clipped at nine-tenths. A real corner is round at the scale of its top harmonic, so the order is a property of the peak at the size of the sample interval, and the law bends where that interval reaches the rounding. A parabola through three samples takes a round peak from the second power to the fourth, gives a corner nothing but a quarter, and makes a flattened peak nine times worse. A rate quoted for a peak reading is a statement about one shape.
Still open: the noise on a largest sample, an aperture on a corner, and two rates on one meter
A largest sample with noise on it. With noise on each sample the largest is the maximum of several noisy values and is biased high by an amount that grows with the number of samples near the peak, while the shape’s shortfall pulls it low. For a stated noise level there is a rate at which the two cancel, a rate beyond which the bias dominates, and the order of the peak decides how many samples are near it. The best rate for a peak-reading instrument is a function of noise and shape together.
An aperture on a corner. A sampler that averages over a window is a filter that rounds every corner at the window’s own width, so a sampler’s aperture gives an upper limit on the order a peak can have when read through it. What fraction of a sample interval the aperture can be, before the corner’s reading stops improving with rate, is a measurement that would put a floor under the line.
The order measured by the meter. A peak meter with two clock rates can read its own waveform’s order from the ratio of two shortfalls. Whether that ratio is usable on a real signal, with a peak-hold reference that is itself sampled and with noise in both readings, is a question about how many cycles it takes to know the slope.
Part 4 on sample rate
One argument about Sample rate, 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.
Convergence orderModel rangeNyquist ratePower law fitReconstructionSample rate
- The filter that samples model range, nyquist rate, sample rate
- A ladder is not a line convergence order, power law fit
- How many straight lines a diode is model range, power law fit
- One bit, and where the noise went convergence order, sample rate
- One knob, and the two exponents it turns power law fit, reconstruction
- The clock that is too fast model range, sample rate