# Calculating the extent of spectral leakage

As a follow up to this question -

Is there a way that I can calculate the amount of spectral leakage in a given bin, i.e., given an input amplitude, what percentage of the amplitude is present in the adjacent bins?

Or given an input frequency and the frequency range of each bin, can I calculate the amplitude present in each bin?

Windowing in the time domain results in a convolution with the transform of that window in the frequency domain. So you need to compute the result of this convolution to see the effect (which some call "leakage").

You can sample the transform of the window function used (rectangular, Von Hann, etc.) to determine the FFT frequency response of a windowed pure single frequency sinusoid. For a rectangular window, the magnitude of the apparent "leakage" in an FFT result will be samples of a normalized Sinc function (more precisely a pair of normalized periodic Sincs or Dirichlet kernels), sampled at integer offsets from the frequency bin center offset, multiplied by the sinusoid's magnitude.

An attempt at the equation for the full Dirichlet pair frequency response result is on my dsp web page here: http://www.nicholson.com/rhn/dsp.html#4

But using just a normalized Sinc as the window transform equation is usually close enough, except for the bins right next to DC or 0 Hz and to bin N/2.

For windows other that rectangular, use their transform instead of a Sinc function, up-sampled and/or interpolated if needed.

There are several measures that fred harris used in his 1978 paper Use of Windows for Harmonic Analysis.

• Highest Sidelobe Level (dB)
• Sidelobe falloff (dB/octave)
• Coherent Gain (unitless)
• Equivalent Noise Bandwidth (bins)
• 3.0 dB Bandwidth (bins)
• Scallop Loss (dB)
• Worst Case Process Loss (dB)
• 6.0 db Bandwidth (bins)
• Overlap correlation (%)

A screenshot of Table 1, comparing several different windows on these measures is below. I think the best solution of your problem is to use a Windowing Function like Hann Function, which reduce the spectral leakage:

Not windowed Windowed with Hann Window This method, however, won't let you recover the original amplitude of that frequency bin (Notice that, in this case, the windowed signal lost about 40% of its energy).