BinspanKnow your frequency grid

THE GRID, EXPLAINED

Know what a bin centre means.

A DFT evaluates a finite set of frequencies. This tool describes that set for a uniformly sampled real signal; it does not run the transform.

Spacing and indices

For sampling rate fs in samples per second and length N, adjacent bin centres are separated by Δf = fs/N Hz. The one-sided nonnegative grid uses k = 0 through floor(N/2). Each centre is fₖ = k × Δf. The number of bins is floor(N/2) + 1, including DC at k = 0.

Δf = fs/N
K = floor(N/2)
fₖ = k × fs/N, for 0 ≤ k ≤ K

Nyquist and the actual endpoint

The theoretical Nyquist frequency is fs/2. With even N, K = N/2 and the highest represented bin equals it. With odd N, K = (N−1)/2 and the highest bin is below fs/2 by half a bin spacing. A target at fs/2 is allowed, but for odd N its nearest represented bin is below it.

Record duration and final sample time

This model uses N acquired samples and a transform of the same length, with sample times 0, 1/fs, …, (N−1)/fs. It reports N/fs as the record duration used for this DFT grid. The final sample’s offset from the first is (N−1)/fs. Those quantities differ by one sampling interval; neither is silently substituted for the other.

The optional target lookup

Leaving the target blank skips lookup. Entering 0 requests the DC bin. Otherwise, the tool compares the target with available neighbouring centres using exact rational arithmetic. If two represented bins are equally distant, it chooses the lower index. This tie rule is an explicit software decision, not a signal-detection convention.

The signed error is centre minus target: negative means the selected centre is below the target. The result names a grid bin; it does not show that a signal actually contains energy at that frequency.

Exact fractions and readable decimals

Accepted sampling-rate and target decimals are parsed as exact integers scaled by one million. Length N is an integer. Fractions are reduced using integer arithmetic. Decimal displays round to at most 12 fractional digits, half away from zero; a very small nonzero value uses scientific notation so it is not displayed as zero. Rounding never chooses the nearest bin. Text and JSON retain exact fractions and assumptions.

Assumptions and limits

Bin spacing alone does not determine whether two tones can be resolved. The acquired data, window main-lobe width, leakage and noise matter. A longer record or a narrower arithmetic grid does not by itself guarantee a useful frequency estimate. This tool does not assess aliasing in actual data.

Primary references

The even/odd one-sided frequency grid is documented in the NumPy rfftfreq reference. The numerical implementation here is independent and does not load NumPy. NI’s FFT and windowing explanation and the SciPy spectral-analysis guide give useful context for leakage, windowing and signal estimation.

Calculate a grid →