# misunderstanding of spectral leakage

I want to understand spectral leakage.

I understand that whenever we feed $$N$$ time-samples of a periodic, continuous, signal into a FFT algorithm we are multiplying in time-domain the true periodic, continuous, signal with a rectangular window, this resulting in a convolution in the frequency domain of the true signal's FT with the rectangular window's FT. I also know that the FT of a square function is a sinc function.

I do not understand the idea of having an integer number of cycles within the time period covered by those $$N$$ time-samples of the continuous signal we feed into the FFT. I want to find out why if we have a (windowed by a square due to the finite value of $$N$$) pure sinusoid (one frequency only) as input to the FFT, and if this length-$$N$$-signal contains an integer number of sinusoid's cycles within the time range it covers, then there is no spectral leakage.

What I think is that in the frequency-domain we shall get a sinc function extending to $$\pm \infty$$, with its main lobe centered at the frequency of the sinusoid. So there is going to be non-zero counts in all the bins across the (horizontal) frequency axis. This is just how life is due to the finite $$N$$.

Questions:

1. Does each bin from across the returned-from-the-FFT frequency axis ''summons'' / ''displays'' a sinc function with its main lobe centered on that specific bin? That would be, if we gather $$N=10$$ bins from the FFT algo because we fed in a length $$N=10$$ signal, we will have a superposition of $$N=10$$ sinc functions in a spectrum plot?

2. If somehow I manage to make the returned-from-the-FFT frequency 1D array to contain in its components the frequency of my sinusoid, will I obtain ONLY 1 sinc function appearing on the spectrum plot? That sinc function will have its main lobe centered on the frequency of interest.

3. It seems from the above two points that there is going to be spectral leakage to other-than-the-center-lobes of that only sinc function appearing in the spectogram, just by the nature of things. Is the explanation for not seeing this leakage in the spectrum plot the fact that the sinc function's side lobes which still contain a reasonable count-value (so which doesn't tend to 0, but it's still visible with the eye) are at such frequencies that they don't reach the next nearby bin? In other words, the very next bins (left and right to the sinusoid's frequency bin) are so far away from the main (important) bin that the amount of counts they get is negligible and this is why when we plot the spectrogram we see a sharp peak on the important beam and "nothing" at other bins? Or is it actually a precise cancellation which is happening and by magic all the other bins get exactly 0 counts?

4. If I don't manage to make the returned-from-the-FFT frequency 1D array to contain in its components the frequency of my sinusoid, then the sinusoid's frequency will for sure be between 2 bins. Then 2 bins will each summon a sinc function and the spectogram will show the superposition of 2 sinc function now. Is this correct?

I would greatly appreciate (material from anywhere) with equations and or graphs, in addition to a "wordy explanation". I don't mind reading another answer already posted, if that responds to my question, however I kind of searched with a filter through all DSP's questions and read the potentially useful ones, however I still don't understand my questions above ...

Thank you!

• This answer may be of interest to you: dsp.stackexchange.com/questions/32013/… Nov 27 '21 at 17:51
• @DanBoschen, hello, thank you. I have read that. Nov 28 '21 at 11:29

whenever we feed N time-samples of a periodic, continuous, signal into a FFT algorithm

You can't feed a continuous signal into an FFT. You need to sample it first at a specific sample rate.

Sampling makes the time domain signal discrete and something that's discrete in one domain MUST be periodic in the other domain. The FFT implements the Digital Fourier Transform (DFT) NOT the Continuous Fourier Transform. Since the DFT transforms discrete signals into discrete signals, this also means that both time domain and frequency domain are periodic. The frequency domain period is the sample rate and the time domain period is the FFT length times the sample period.

There are two ways to think about spectral leakage

Sampling in the frequency domain creates periodic repetition in the time domain. If your sine wave does NOT have an integer amount of periods, the repetition will create discontinuity at the repetition point and your continuous time domain signal is not a sine wave anymore.

See the graph below. The picture shows two sine waves: 1 at 1 cycle per FFT and the other at 1.5 cycles per FFT. If you repeat them the 1.5 cycle sine wave will have a strong discontinuity at the period border. The 1 cycle sine wave stays a sine wave.

Your interpretation of the sinc function also works. I you have an integer multiple of periods, than all the zeros of the sinc function in the frequency domain fall on the "other" FFT bins. The spectrum can still determined by convolution with a sinc function, however the contribution of the sinc function to all other FFT bins is zero.

Does each bin from across the returned-from-the-FFT frequency axis ''summons'' / ''displays'' a sinc function with its main lobe centered on that specific bin?

Kind of yes. It's just that a sinc centered on one FFT bin has all its zeros on the other bins

If somehow I manage to make the returned-from-the-FFT frequency 1D array to contain in its components the frequency of my sinusoid, will I obtain ONLY 1 sinc function appearing on the spectrum plot? That sinc function will have its main lobe centered on the frequency of interest.

Yes. Again: if the frequency of interest coincides with an FFT bin the sinc will be 0 on all other bins. If not, you get spectral leakage.

Or is it actually a precise cancellation which is happening and by magic all the other bins get exactly 0 counts?

That one. It's not magic, it's the definition of the sinc function.

Then 2 bins will each summon a sinc function and the spectogram will show the superposition of 2 sinc function now. Is this correct?

No. There is only one sinc centered at the frequency of the sine wave. That frequency does NOT coincide with an FFT bin, so the value at any FFT bin will be determined by the normalized difference between the bin frequency and the sine frequency.

Let's take a look at the normalized sinc function

$$\operatorname{sinc}(x) = \frac{\sin \pi x}{\pi x}$$

This graph is normalized to the bin spacing of the FFT. Each bin "samples" the sinc function. If you sample at integers all values of the sinc function are zero except the one at $$x = 0$$. If you sample at a non-integer grid, you will get non-zero values at all frequency bins.

• //"No. There is only one sinc centered at the frequency of the sine wave."// ------ Hil, that is not correct if the sine wave is real. Any real sinusoid having normalized (f_\mathrm{s}=1) frequency of $f$ will have two sinc functions centered at (or between bins) $N\cdot f$ and $N\cdot(1-f)$ . And if $N\cdot f \notin \mathbb{Z}$ is not centered on an integer bin, then the sinc functions will overlap and add. Nov 27 '21 at 18:43