Where a signal becomes a number

The rate each reading needs

Twice the frequency is the rate at which a set of samples holds a sinusoid completely, and it is not the rate at which any particular property can be read off them. Eight samples a cycle — four times the Nyquist rate — hold the waveform, and their largest is still 7.61% below the peak; the largest sample needs 22.2 a cycle for 1% and 70.2 for 0.1%, because its error falls only as the square of the rate. A parabola through the three largest gets 1% at 8. A zero crossing found by a straight line between two samples is a hundredth of a cycle right at 5 a cycle, its error falling as the cube, because a sine is straight at its zero. The rms of whole cycles is exact from three a cycle — and at exactly two it reads anything from zero to √2. A slow rate with a long record of a steady signal does what a fast rate does, once the samples have slipped a whole interval past it: 42 cycles at 4.0236 a cycle.

Assumes: The frequency a sample rate invents

The frequency a sample rate invents measured the one boundary in this field with no gradient at all: below half the sample rate a set of samples has one sinusoid through it, above half the sample rate it has another, and the two sets of numbers are identical to three parts in ten thousand billion. An exact answer to a different question then measured what the reconstruction sum does with samples on each side of that boundary: it returns the waveform the samples were taken from below it, and the alias above it, each to the same accuracy.

Between them those two essays establish what the Nyquist rate guarantees, and it is a strong guarantee. Samples taken faster than twice the highest frequency present determine the waveform completely; nothing has been lost, and the reconstruction can recover any value at any instant. What they do not say is how much work that recovery is. A great deal of measurement does not reconstruct at all — an oscilloscope reports the largest sample as the peak, a frequency counter times the zero crossings, a power meter sums the squares — and each of those readings takes the samples at face value. This essay asks, for each common reading, how fast the samples must come for the reading to be right without any reconstruction, and the answer is a different power of the rate for each.

Everything there, the peak not on show

Take a unit sinusoid and sample it eight times a cycle, synchronously, at the sampling phase that puts its peak exactly between two samples.

A sinusoid sampled 8 times a cycle, at the phase that puts its peak between two samplescomputed by solving, not by drawing: the samples of a unit sinusoid at 8 a cycle, synchronous, at the sampling phase that hides its peak worst. 8 samples a cycle is 4 times the Nyquist rate and holds the waveform completely; the largest sample is still 0.9239, 7.61% below the peak, which is 1 − cos(π/8). Read straight off the samples the peak needs 22.2 samples a cycle for 1% and 70.2 for 0.1%.-10100.50011.502time, in cycles of the inputamplitudelargest sample 0.9239solved, then checked — everything there, the peak not on show7.61% low at 8 a cycle
Fig. 1 A unit sinusoid sampled eight times a cycle, synchronous, at the phase that puts its peak midway between two samples. Eight a cycle is four times the Nyquist rate and holds the waveform completely; the largest sample is 0.9239, 7.61% below the peak — 1 − cos(π/8). The slider is the samples a cycle.

Eight samples a cycle is four times the Nyquist rate, and the samples determine the waveform exactly. The largest of them is 0.9239, 7.61 per cent below the peak. At the worst phase the peak sits half a sample interval from the nearest sample, and a cosine half an interval from its maximum has fallen to cos⁡(π/M)\cos(\pi/M) of it, where MM is the number of samples a cycle. No other phase is worse, and the solve confirms the worst over 360 starting angles equals that closed form to a part in a million.

The slider shows how slowly the largest sample improves. At three samples a cycle it is half the peak; at four, 29.3 per cent low; at 22, about one per cent; at 70, a tenth of a per cent. The largest sample needs 22.2 samples a cycle to be within one per cent of the peak, and 70.2 to be within a tenth — eleven and thirty-five times the Nyquist rate. An oscilloscope that samples a ten-megahertz sine at a hundred megasamples a second and reports the largest sample as its amplitude reads up to five per cent low, and the waveform it displays is perfectly sampled.

Four readings, four powers of the rate

The largest sample is one reading. Others are made from the same samples, and each has its own error law, which is the substance of the essay.

Four readings taken straight off the samples of a sinusoid, and how each one's worst error falls with the rate. computed by solving, not by drawing, each reading's error maximised over 360 sampling phases at each of 15 rates. The rms of a whole number of cycles is exact, to rounding, from three samples a cycle up. The time of a zero crossing, from a straight line through the two samples either side, errs as the cube of the period over the rate (fitted −3.00): a hundredth of a cycle by 5 samples a cycle. The largest sample errs as the square (−2.00): 1% needs 23. A parabola through the three largest errs as the fourth power (−4.00): 1% by 8.
Fig. 2 Four readings taken straight off the samples of a sinusoid, each error maximised over 360 sampling phases, against the samples a cycle from 3 to 128. Largest sample: falls as the square of the rate, 1% at 23. Zero-crossing time by a chord: as the cube, a hundredth of a cycle by 5. Parabola through the three largest: as the fourth power, 1% at 8. Rms of whole cycles: exact from 3.

Fitted over the top of the range, the largest sample’s error falls as the rate to the power −2.00: a cosine is flat at its maximum, so the shortfall half an interval away is quadratic in the interval. A parabola through the three largest samples, which takes the curvature into account, errs as the fourth power, −4.00, and reaches one per cent at eight samples a cycle — a peak-reading oscilloscope’s “interpolation” setting is buying exactly this. The time of a zero crossing, from a straight line through the two samples either side of it, errs as the cube, −3.00, and is right to a hundredth of a cycle at five samples a cycle. And the rms of a whole number of cycles is exact, to rounding, from three samples a cycle upwards.

Each power has a reason that belongs to the shape of the sine at the point being read. A maximum is where the waveform is flat to first order, so a sample near it reveals almost nothing about how far it is from the top. A zero crossing is where the waveform is straight to second order — a sine has an inflection there — so a straight line through two samples is nearly right. The rms of whole cycles is a sum of squares of equally spaced cosines, which is exactly half the number of samples by a trigonometric identity that holds for any three or more per cycle. The reading decides the rate, and the Nyquist rate is the rate at which no reading at all is impossible.

Time instead of rate

A synchronous sampler — one whose rate is an exact multiple of the signal’s — sees the same phases every cycle, and if those phases miss the peak, they miss it for ever. A sampler slightly off a multiple sees a slowly sliding set of phases, and that changes the arithmetic for any steady signal.

The largest sample of a record taken at 4.0236 samples a cycle, against the record's length. computed by solving, not by drawing for fifty seeded starting phases at each of 49 lengths, the worst of the fifty drawn. At 4.0236 samples a cycle — just off four, so the samples land at a new phase every cycle — one cycle's largest sample is up to 30.0% low, as a synchronous four a cycle would be (29.3%). Over a longer record the sample grid slips past the input by 0.0236 of a sample interval each cycle, and once it has slipped a whole interval — 42.4 cycles — some sample has landed near every phase: the shortfall is under 1% by 38 cycles, under 0.1% by 46, and 2.4e-8 after 10000. A slow rate and a long record of a steady signal read the peak as well as a fast rate does, and a rate locked to the input never does, however long the record.
Fig. 3 The worst shortfall of the largest sample, over fifty seeded starting phases, for records from 1 to 10,000 cycles taken at 4.0236 samples a cycle. One cycle: up to 30.0% low. The grid slips 0.0236 of an interval each cycle; after one whole interval of slip, 42.4 cycles, some sample has landed near every phase: under 1% by 38 cycles, under 0.1% by 46.

At 4.0236 samples a cycle — just off four — one cycle’s largest sample is up to 30.0 per cent low, as a synchronous four a cycle would be. But the sampling grid slips past the signal by 0.0236 of a sample interval each cycle, so after 42.4 cycles it has slipped a whole interval, and by then some sample has landed close to every phase of the waveform, including its peak. The worst of fifty seeded starts is under one per cent by 38 cycles and under a tenth of a per cent by 46, and after ten thousand cycles it is two parts in a hundred million.

So for a steady signal, rate and time trade freely. A slow sampler and a long record read the peak as well as a fast sampler does, provided the rate is not locked to the signal; an equivalent-time sampling oscilloscope builds a picture of a multi-gigahertz waveform from a few samples per repetition in exactly this way. What the trade cannot do is help a signal that happens once. A single pulse sampled at four points a cycle is read thirty per cent low with no record to lengthen, and the rate is then the only knob.

The rms needs more than two

The rms reading converges fastest, but it has its own boundary, and it sits exactly at the Nyquist rate.

The rms read from the samples at two, two and a half and three samples a cycle, against the sampling phase. computed by solving, not by drawing at 73 phases. At exactly two samples a cycle — the Nyquist rate — the reading runs from zero to √2 times the true rms as the phase moves, because the two samples a cycle are the same two numbers for ever. At three a cycle over ten cycles, or at two and a half over ten (twenty-five samples, a whole number of repeats of the pattern), it is exact at every phase. Over 10.4 cycles at two and a half it is within 1.9%: the error belongs to the part-cycle at the end of the record, not to the rate.
Fig. 4 The rms read from the samples over ten cycles, divided by the true rms, against the sampling phase: at exactly two samples a cycle (solid), from zero to 2\sqrt 2; at three a cycle, and at two and a half over a whole number of repeats of the pattern, exact at every phase; at two and a half over 10.4 cycles, within 1.9%.

At exactly two samples a cycle the two samples are Acos⁡ϕA\cos\phi and −Acos⁡ϕ-A\cos\phi for ever, and their rms is A∣cos⁡ϕ∣A|\cos\phi| against the true A/2A/\sqrt2 — anything from zero, when every sample lands on a zero crossing, to 2\sqrt 2 times the true value, depending only on where the sampling started. Above two the reading becomes exact for a whole number of cycles: at three a cycle at every phase, and at two and a half a cycle too, provided the record holds a whole number of repeats of the five-sample pattern. Over 10.4 cycles at two and a half it is within 1.9 per cent, and the error belongs to the part-cycle at the end of the record rather than to the rate.

That locates the rms reading’s real requirement, which the cycle a converter has to know measured from the other side: the record must hold a whole number of periods, or be long enough that the part-period does not matter. A true-rms instrument that samples above twice the highest harmonic and averages over many cycles is therefore right for reasons that have nothing to do with its rate beyond that, and the noise a true-rms meter reads low is the case where the averaging, not the sampling, is the limit.

A chord through an inflection

The zero-crossing reading deserves one more look, because its accuracy is surprising and its structure is not quite what the power law suggests.

The error in a zero crossing found by a straight line between two samples, across one sample interval, at 8, 16 and 32 samples a cycle. computed by solving, not by drawing at 101 positions of the crossing in its interval. The error is zero when the crossing falls on a sample and when it falls exactly between two, and it changes sign between: a sine is straight at its zero, so a chord through two samples symmetric about it is exact, and the error is the third-order bend either side. The worst is 1.0e-2 of an interval at 8 a cycle, 2.5e-3 of an interval at 16 a cycle, 6.2e-4 of an interval at 32 a cycle: a factor of about four for each doubling, so in fractions of a cycle the cube of the rate.
Fig. 5 The error in a zero crossing found by a straight line between the two samples either side, against where the crossing falls in its sample interval, at 8, 16 and 32 samples a cycle. Zero when the crossing falls on a sample or exactly between two; worst 1.0 × 10⁻², 2.5 × 10⁻³ and 6.2 × 10⁻⁴ of an interval.

The error is zero when the crossing falls on a sample, trivially, and zero again when it falls exactly between two: the samples are then symmetric about an inflection point, and a chord through two points symmetric about a sine’s zero passes through the zero exactly. Between those positions the error changes sign and reaches 1.0 × 10⁻² of a sample interval at eight samples a cycle, 2.5 × 10⁻³ at sixteen and 6.2 × 10⁻⁴ at thirty-two — a factor of four each doubling, so in sample intervals it falls as the square and in fractions of a cycle as the cube.

That is why frequency counters and phase meters can work from coarse samples. A crossing interpolated from eight samples a cycle is right to about a thousandth of a cycle, a phase error under half a degree, at a rate a peak reading would find seven per cent low. The same chord applied anywhere else on the waveform — to find when the signal passes half its amplitude, say, which a rise-time measurement does — has no inflection to help it, and its error falls only as the square.

One oscilloscope, four signals

Put the four laws on one instrument. An oscilloscope sampling at a hundred megasamples a second, with a bandwidth comfortably above the signals it is shown, reports a peak amplitude, a frequency and an rms for each of four sine waves: one, five, ten and twenty-five megahertz. That is a hundred, twenty, ten and four samples a cycle — every one of them comfortably above the Nyquist rate, and every one of them, by the sampling theorem, a complete record of its signal.

Its frequency readings, taken from interpolated zero crossings, are good to a few ten-thousandths of a cycle per crossing at ten samples a cycle and far better at twenty and a hundred; at four samples a cycle, the twenty-five-megahertz signal, the cube law allows about a hundredth of a cycle per crossing, and averaging many crossings over a record shrinks that further. Its rms readings, taken over whole cycles of the record, are exact at all four. Its peak readings, taken as the largest sample of a single acquisition of a signal locked to the clock, are 0.05 per cent low at one megahertz, 1.2 per cent at five, 4.9 per cent at ten and up to 29 per cent at twenty-five. The same instrument, the same acquisition, the same signal: three readings it gets right and one it gets wrong by a quarter, depending only on which property is asked for.

That is the practical content of this essay, and it explains a pattern familiar to anyone who uses such an instrument. Peak and peak-to-peak readings of fast signals scatter from acquisition to acquisition while the frequency and rms readings of the same signal are steady: the scatter is the sampling phase moving between acquisitions, and it disappears either at a higher sample rate or, for a repetitive signal whose frequency is not locked to the clock, when enough acquisitions are combined that the phases fill in. The instrument’s own rise time is the other limit on the same readings, and it is independent of this one: an oscilloscope’s analogue bandwidth flattens a fast edge before any sampling happens, and no rate repairs it.

The converter’s resolution is a third limit and it combines differently. Six decibels a bit measured the quantiser’s own floor; an eight-bit converter’s step is 0.78 per cent of a full-scale sine’s peak, about the sampling shortfall at twenty-two samples a cycle, and the shortfall at ten samples a cycle is six times larger. On a fast signal the sampling, not the resolution, decides how well the peak is known — and buying more bits buys nothing for it.

What this does and does not say about the Nyquist rate

None of this contradicts the sampling theorem; it reads it more precisely. The theorem promises that the samples contain the waveform. It promises nothing about readings that do not reconstruct it, and most practical readings do not, because reconstruction — the sum of sinc functions an exact answer to a different question measured converging slowly — is expensive. Each shortcut reading has a rate at which it becomes as good as reconstruction would have been, and the list above is the list of those rates for a sinusoid: three a cycle for the rms of whole cycles, five for a crossing to a hundredth of a cycle, eight for a parabolic peak to a per cent, twenty-two for a raw peak.

For a waveform with harmonics, each reading’s rate applies to the highest harmonic that matters to it. A square wave’s peak is set by its fundamental and every odd harmonic in phase, so reading its peak from samples needs the raw-peak rate for the highest harmonic retained; its rms, the rms rate for the same harmonic. What a meter multiplies by found a true-rms meter that reaches nine harmonics two per cent low on a square wave; that error is the harmonics’ bandwidth, not their sampling, and it would remain at any rate. A picosecond read as bits is the reminder that every number here assumes samples taken at exactly the instants intended; jitter adds an error that grows with the slope at the sample, which is largest at the zero crossings this essay found easiest to read.

How the readings were taken

Every reading is computed from explicit samples of a unit cosine at stated phases, with no reconstruction anywhere: the largest sample by comparison, the parabola by the three-point vertex formula, the crossing by linear interpolation between the samples straddling the first upward zero, the rms as the root of the mean square. Worst cases are maxima over 360 equally spaced sampling phases within one sample interval, and power laws are slopes fitted over the top three octaves of the rate. The long-record figure draws fifty starting phases from a seeded generator at each length and plots the worst. The raw-peak closed form, 1−cos⁡(π/M)1 - \cos(\pi/M), is checked against the sampled worst case to a part in a million, and the rms is checked exact at every phase at three samples a cycle.

The signal is a pure, noiseless sinusoid of exactly known frequency. Noise on the samples makes the largest sample read high rather than low — the maximum of a noisy set is biased upward — and at some rate the two errors cancel, which no reading here was asked to exploit.

Still open: noise on the samples, a waveform with a sharp peak, and the rate a rise time needs

The largest sample of a noisy record. With noise on each sample, the largest sample is the maximum of a set of noisy values and is biased high by an amount that grows with the number of samples near the peak, while the sampling shortfall pulls it low. For a stated noise level there is a rate at which the two cancel and a rate beyond which the noise bias dominates, and a peak-reading instrument’s best rate is the first of them.

A peak that is not round. The square law belongs to a maximum with a continuous second derivative. A triangle wave’s peak is a corner, and the largest sample then falls short in proportion to the interval rather than its square — one power slower. A clipped sine is flat and falls short by nothing until the flat top is shorter than an interval. Which law a real waveform’s peak follows is a property of its shape at the peak, and the rate a peak reading needs follows from it.

The rate a rise time needs. A ten-to-ninety per cent rise time interpolated from samples has no inflection to help it at either threshold, so its error falls only as the square of the rate, and it is read from two thresholds whose errors may add. How many samples per rise time give a rise-time reading to a stated accuracy — a question every oscilloscope specification answers with a rule of thumb — is the crossing figure moved to the ten and ninety per cent levels.

Part 3 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:

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.

AliasingConvergence orderModel rangeNyquist rateReconstructionSample rateTrue-rms