Coherent sampling 2026-11-05
Coherent sampling records an integer number of cycles of a periodic signal in the observation interval used for a discrete Fourier transform. For equally spaced samples at sampling rate , a single sinusoidal frequency is coherent when
This is a frequency-and-record-length condition, not merely starting the acquisition at a particular phase.[ref]
For the complex tone , the unnormalized discrete Fourier transform gives
A real cosine has the corresponding positive- and negative-frequency bins. The cancellation follows from a finite geometric sum; arbitrary phase does not spoil it. Periodic continuation means , not that the last stored sample must equal .
For example, and make a tone coherent, while is off the DFT grid. The latter's rectangular window record generally has spectral leakage into multiple bins. The bin spacing remains in both cases: coherence has not changed the grid spacing or increased the record duration.
Choosing relatively prime to can help an analog-to-digital converter test sample more distinct input phases, but it is an additional condition. A -cycle tone in samples is coherent even though its sampled phases repeat after only samples. The manufacturer's application note discusses the irreducible-ratio choice separately from the integer-cycle equation.[ref]
An experiment must also maintain the required ratio over the record. Frequency drift or clock variation can invalidate a nominal setting. If coherence cannot be maintained, a different window function can reduce leakage, with changes to amplitude scaling and spectral spread accounted for through the coherent gain of a window.
Finite-record phasor extraction with coherent sampling recovers a sinusoid's complex amplitude by arranging its frequency on a discrete Fourier bin. Let samples be taken at , with containing exactly cycles, where is an integer and . For
the constant baseline cancels from bin . The peak phasor versus positive-frequency Fourier coefficient relation then gives the estimate
The factor assigns wave phase to the stated physical time origin; without it the coefficient refers to the record's start. The default forward FFT is unscaled, while other FFT normalization modes require different prefactors.[ref]
For an original example, sample at with and use a tone, so and the cyclic record duration is . Let its physical peak phasor be and let . The record-start wave phase is , and the unscaled bin is
Applying both and the time-origin correction recovers the physical phasor. Its RMS amplitude is . Omitting the start-time correction would give a correct magnitude but a different wave phase reference.
With independent zero-mean real noise of variance on each sample, the extracted phasor remains unbiased. Orthogonality gives noise variance in each real and imaginary component and zero covariance between them. For here, each component's standard deviation is about . These are complex-amplitude uncertainties; taking a magnitude is a nonlinear operation and need not retain unbiasedness.
Coherent sampling must describe the actual source/clock relationship, not just the rounded frequency entered into software. Frequency drift, extra tones, aliasing or a changed window invalidate the simple exact-bin identity; spectral leakage bias in harmonic distortion measurements shows one consequence. A coherent gain of a window can correct an on-bin amplitude scale in suitable models, but cannot in general turn a noncoherent one-bin reading into an exact phasor.
The half-bin amplitude response of a window is the magnitude response to an isolated tone halfway between neighboring discrete Fourier transform frequencies, divided by the response to a bin-centered tone of the same amplitude. It quantifies a particular off-grid amplitude error after correcting the coherent gain of a window. For coefficients with nonzero sum, define
A loss convention reports in decibels. The primary instrument manual tabulates approximately for rectangular weighting and for Hanning weighting.[ref]
To derive the ratio, take a complex tone . Evaluating the windowed transform at bin gives . For real window coefficients, the responses at opposite offsets have equal magnitude. Dividing by removes the on-bin scaling and leaves . This calculation isolates the frequency-grid effect from noise and other spectral components.
For a rectangular window, summing the geometric series yields
For , the ratio is about . The large- value is about , explaining the familiar scalloping loss rather than an exact finite-record constant.
For the periodic Hann window, . Its finite response is
where is the rectangular response and for . Substitution gives about at . A useful limiting derivation replaces the normalized sum by its integral:
with continuous limiting values at . At its magnitude is . For a short periodic window, the coefficients instead give . The finite definition avoids treating the asymptotic value as exact.
The symmetric Hann window uses denominator , not ; it has a different finite response and coefficient sum. SciPy explicitly distinguishes the symmetric filter-design convention from the periodic spectral convention.[ref] The exact half-bin ratio should therefore use the coefficients actually applied.
For an original acquisition example, a -sample record at has bin spacing. A complex tone at lies halfway between bins 10 and 11. An amplitude-one tone gives a corrected nearest-bin magnitude about with rectangular weighting or with periodic Hann weighting. Zero padding changes the sampled grid of the same discrete-time Fourier transform; if the padded grid contains , its value there has no half-bin error relative to that tone.
The half-bin response is not automatically a universal worst-case bound for every conceivable window. Nor does the isolated-complex-tone calculation cover every real-sinusoid measurement: near zero frequency or the sampling limit, the mirrored spectral component can overlap and make the observed magnitude phase-dependent. A proposed test sweeps a constant-amplitude tone through a bin interval, varies phase for real signals, and compares the complete finite-sum response before quoting a single off-bin accuracy number.
Hann window 2026-11-05
A Hann window tapers a record with a raised cosine. For the endpoint-symmetric convention with ,
It vanishes at the two stored endpoints. A periodic convention instead uses denominator , corresponding to sampling one cosine period without storing its repeated endpoint. SciPy's primary documentation distinguishes these with sym=True and sym=False; the default is symmetric.[ref] The adjacent Hanning window alias also supports the terminology used in older instrument documentation.
An original short-array example makes the difference concrete. At , the symmetric coefficients are , while the periodic coefficients are . Their means are and . A symmetric even-length array need not contain a coefficient equal to one, despite the nominal raised-cosine peak.
The coherent gain of a window is . It equals for the periodic Hann convention with , and for the symmetric convention with . A coherent complex tone gives windowed DFT magnitude at its exact bin, so amplitude recovery must use the chosen coefficient sum.
For the periodic convention, its discrete-time Fourier transform is obtained from the rectangular window transform by modulation:
The first central zeros lie at for the usual case, twice as far from the center as the rectangular window's first zeros. Smooth tapering reduces distant sidelobes while widening the central feature. Nearby frequencies and a weak component far from a strong one can therefore favor different window choices.
Noise normalization is another distinction. For , the periodic Hann coefficients obey and , giving equivalent noise bandwidth
in DFT bins. The manufacturer's table lists both coherent gain and noise bandwidth.[ref] Correcting a coherent amplitude does not make noise behave as though the rectangular weights had been used.
The original comparison below evaluates the finite 64-sample periodic Hann and rectangular coefficients at a dense frequency grid, normalizing each response by its own coefficient sum. The extra frequency samples display the same finite-record transform more finely; they do not create a longer observation.
Figure 1.
Original 64-sample rectangular and periodic Hann windows: lower distant sidelobes accompany a wider central lobe
. Each spectral curve is normalized to its own coherent peak. The horizontal frequency axis is measured in DFT-bin offsets. The first positive zeros are at one bin for the rectangular window and two bins for the periodic Hann window. Details.
Rectangular window 2026-11-05
A rectangular window keeps all samples in a selected finite record with equal weight and sets the signal outside it to zero. For discrete samples, for and zero otherwise. Calling this no taper does not remove the effect of having a finite record. SciPy's primary implementation documentation identifies the boxcar and rectangular window as this same all-ones choice.[ref]
Its discrete-time Fourier transform at frequency in cycles per sample is a finite geometric sum:
At integer , the limiting value is . The first zeros surrounding the central maximum are at , so the central zero-to-zero width is . The phase factor depends on the record's time origin; the magnitude response does not.
For a continuous centered record of duration , on has transform
where the normalized sinc function is . Multiplication by the finite window spreads a sharp spectral component according to this response, producing spectral leakage.
An original finite-record example quantifies an off-bin amplitude error. A complex tone of amplitude lying half a DFT bin from the nearest sampled frequency has normalized response
At the ratio is about , or relative to the coherent peak. The coherent gain of a window is still one; it does not correct this scalloping loss. Zero-padding samples the same frequency response more densely rather than lengthening the measured record.
For independent equal-variance sample noise, rectangular weighting has equivalent noise bandwidth of one DFT bin under the usual coherent-amplitude normalization. A Hann window suppresses distant sidelobes but changes the central width and noise scaling. The primary analysis manual reports these separate window properties rather than one universal best window.[ref]
A proposed test records a known sinusoidal input with an integer and then a non-integer number of cycles in the same record length, holding the sampling rate and amplitude fixed. Compare the raw DFT bins and the continuous window response. This separates finite-record leakage and bin placement from aliasing, which involves a different sampling ambiguity.
Scalloping loss 2026-11-05
Scalloping loss is the underestimate of an isolated sinusoidal amplitude caused by measuring it only at the nearest sampled discrete Fourier transform frequency, after correcting the window’s coherent amplitude scale. An off-grid tone is evaluated away from the maximum of the window response. This differs from the coherent gain of a window, which describes the response at the correctly centered frequency. The instrument manual treats amplitude scaling and off-bin errors separately.[ref]
Let be a finite real window with positive sum, and let , where is the nearest unpadded DFT bin and . Write . The coherent-gain-corrected bin magnitude relative to is
Here is a positive loss when . The half-bin amplitude response of a window evaluates this ratio at the largest nearest-bin offset. Other tones, noise and the negative-frequency image of a real sinusoid can also affect a measured peak; the derivation isolates one complex tone.
For a rectangular window, its geometric-sum transform gives
For , the half-bin ratio is about and the loss about . An amplitude-one tone exactly centered on a bin is recovered as one, while the same tone shifted by half a bin gives only about at either nearest bin. Dividing by coherent gain cannot remove this offset dependence.
For the periodic Hann window, use
where is the rectangular response. At , this gives a half-bin ratio about , or loss. The smaller nearest-bin error comes with a wider main lobe and a larger equivalent noise bandwidth; window choice affects several measurement properties at once.
Zero padding reduces the nearest-grid offset without changing the measured record. Padding to points makes the nearest offset at most in original-bin units. With and , the rectangular response at that worst offset is about , a loss of only . This is denser sampling of the same discrete-time Fourier transform, not extra physical frequency resolution. A fitted peak can reduce a grid error too, but its signal model and noise sensitivity must be stated.
A proposed analyzer test holds tone amplitude fixed while sweeping frequency through one bin interval, retaining record length, sampling rate and window. Divide out coherent gain, plot the measured peak versus fractional-bin offset, and compare with the exact response above. Include phase and nearby-tone checks for a real signal. Summing spectral powers instead answers an energy question and requires its own bandwidth normalization; it should not silently replace this single-bin amplitude definition.
Spectral leakage bias in harmonic distortion measurements occurs when a finite record spreads a strong component into bins interpreted as distinct harmonics. A waveform can have zero physical total harmonic distortion while a naive FFT-bin ratio reports otherwise. Confining a sinusoid to a finite interval creates spectral sidelobes; the pinned primary guide derives this leakage from the finite-time Fourier transform.[ref]
For an exact discrete calculation, take , where is the number of cycles in the record. With the unscaled forward discrete Fourier transform, a finite geometric sum gives
where
whenever the denominator is nonzero, with the finite-sum limit elsewhere. Integer-cycle coherent sampling makes the unwanted integer bins cancel; a noninteger cycle count generally does not. The negative-frequency contribution also matters because the input is real.
For an original pure-tone example, let , , and . Its true higher-harmonic amplitudes are zero. Yet choosing the nearest bins , , and for the fundamental, second and third harmonic gives
A naive result would be about distortion from this undistorted sinusoid. This is an exactly specified record calculation, not an instrument's measured distortion floor.
A window reduces some sidelobes at the cost of a broader main lobe and a changed amplitude normalization. Its coherent gain of a window must be treated consistently, and one cannot assume that one selected bin captures a noncoherent tone's full amplitude. Zero padding samples the same finite-record spectrum more densely; it does not restore missing observation time or remove leakage.
A measurement can instead synchronize the source and acquisition for an integer number of cycles, fit a justified sinusoidal model, or use a validated window/band-integration method. The finite-record phasor extraction with coherent sampling gives a particularly transparent exact case. Calibrated receiver response and actual harmonic coverage remain necessary, as in the primary Anritsu apparatus.[ref] Power spectral density and squared-amplitude spectrum outputs also have different units; an arbitrary square root of a density bin is not a calibrated harmonic amplitude.[ref]