Library / Signal processing and digital filters / DSP-20
Signal processing and digital filters
Sub-bin peak location by parabolic interpolation
Refined frequency of a spectral peak from the log-magnitudes a, b and c (same dB scale) at bins k − 1, k and k + 1, fitted with a parabola.
- Ref
- DSP-20
- Rev
- v1
- Field
- Signal processing and digital filters
- Result
- fest [Hz]
A spectral peak is well described by a parabola near its top when the log-magnitudes are used. Fitting a parabola through (k − 1, a), (k, b) and (k + 1, c) puts its vertex at the offset δ = ½(a − c)/(a − 2b + c) from the centre bin, so the frequency is (k + δ)fs/Nfft. The bias depends on the window and on nearby components.
Refined frequency of a spectral peak from the log-magnitudes a, b and c (same dB scale) at bins k − 1, k and k + 1, fitted with a parabola. Use an isolated, concave peak with b largest. This is a local estimate whose bias depends on the window and any nearby components.
Calculator
- Offset from the centre bin, δ0.1667 bins
- Interpolated peak level, b − ¼(a − c)δ−1.917 dB
- Bin spacing, fs/Nfft1 Hz
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- The peak lies 0.1667 bins above bin 20, at 20.17 Hz, against 20 Hz for the bin alone.
- The bin spacing is 1 Hz, so the interpolation resolves the tone to a small fraction of a bin, as long as the peak is isolated and the neighbours are on the same dB scale.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (Hz) | Local step | Change in result |
|---|---|---|---|---|---|---|
| fs Sampling rate | 1 to 1e7 Hz | 0.02017 | 201,700 | 201,700 | +10% | +10 % |
| k Peak bin index | 1 to 100,000 | 1.167 | 100,000 | 100,000 | +1 | +4.96 % |
| Nfft FFT length | 8 to 1,000,000 samples | 0.02017 | 2,521 | 2,521 | +1 samples | −0.0999 % |
| a Log-magnitude at bin k − 1 | −80 to −0.5 dB | 16.5 | 20.48 | 3.975 | +1.59 dB | −0.596 % |
| c Log-magnitude at bin k + 1 | −80 to −0.5 dB | 19.55 | 21.1 | 1.551 | +1.59 dB | +1.19 % |
| b Log-magnitude at bin k | −4.5 to 0 dB | 20.1 | 21 | 0.9 | +0.09 dB | −0.0241 % |
Sweep of Log-magnitude at bin k − 1
| Log-magnitude at bin k − 1 (dB) | Interpolated peak frequency (Hz) |
|---|---|
| −80 | 20.48 |
| −70.06 | 20.47 |
| −60.13 | 20.47 |
| −50.19 | 20.46 |
| −40.25 | 20.45 |
| −30.31 | 20.43 |
| −20.38 | 20.4 |
| −10.44 | 20.31 |
| −0.5 | 16.5 |
Sweep one variable
Variables and how each one contributes
Interpolated peak frequency
What the equation gives you. Everything else feeds it.
Peak bin index
The index of the peak bin. Sets the coarse frequency kfs/Nfft before refinement. Raising it by 10 % (to 22) moves the result by +9.92 %, from 20.17 to 22.17 Hz.
Log-magnitude at bin k − 1
The log-magnitude at bin k − 1, in dB. A stronger lower neighbour pulls the estimate towards a lower frequency. Raising it by 10 % (to −6.6) moves the result by +0.15 %, from 20.17 to 20.2 Hz.
Log-magnitude at bin k
The log-magnitude at bin k, in dB. A larger centre value narrows the peak and moves the estimate towards bin k. Raising it by 10 % (to −2.2) moves the result by +0.059 %, from 20.17 to 20.18 Hz.
Log-magnitude at bin k + 1
The log-magnitude at bin k + 1, in dB. A stronger upper neighbour pulls the estimate towards a higher frequency. Raising it by 10 % (to −4.4) moves the result by −0.207 %, from 20.17 to 20.13 Hz.
Sampling rate
The sampling rate, in Hz. Scales the frequency in proportion. Raising it by 10 % (to 1,100) moves the result by +10 %, from 20.17 to 22.18 Hz.
FFT length
The FFT length. A longer transform gives a finer bin spacing, which lowers the frequency in inverse proportion for a given k. Raising it by 10 % (to 1,100) moves the result by −9.09 %, from 20.17 to 18.33 Hz.
Worked example with the values above
- Offset: δ = ½(a − c)/(a − 2b + c) = ½ × (−6 − (−4)) / (−6) = 0.16667 bins.
- Fractional bin: k + δ = 20 + 0.16667 = 20.1667.
- f = 20.1667 × 1,000 / 1,000 = 20.167 Hz.
Assumptions and limits
- A stationary signal with a tone of constant amplitude and frequency, and a record that holds a whole number of cycles for the coherent formulas.
- A single, well-isolated spectral peak for interpolation, and a bandwidth that is stated.
Common mistakes
- Using these coherent formulas on a record with a non-integer number of cycles.
- Adding noise or a DC offset into the harmonic sum.
- Using a peak that is not the largest of its three neighbouring bins in the parabolic interpolation.
Statistics and uncertainty
Tone amplitude and phase from a single FFT line are accurate to a fraction of a per cent only for a coherent record; for a non-coherent tone, scalloping loss of up to 3.9 dB (rectangular window) or 1.4 dB (Hann) adds error unless it is corrected.
Where it is used
- Measuring amplitude, phase and distortion of tones in an FFT record.
- Refining a frequency estimate without a longer record.
Maths you need
- Coherent sampling: a whole number of signal cycles in the record
- Spectral peak: a local maximum in the spectrum
- Parseval’s theorem: power in the time domain equals power in the frequency domain