# Spectral leakage - understanding the integer number of cycles while windowing

I am reading tutorials about windowing and have read following sentence:

For an integer number of cycles, all smoothing windows yield the same peak amplitude reading and have excellent amplitude accuracy. Side lobes do not appear because the spectrum of the smoothing window approaches zero at Δf intervals on either side of the main lobe.

This term integer number of cycle, I have meet several times and please explain me what does it means? Does it means that periodic functions are integer number of cycles, because they repeat at each period, which is equal main period multiplied by some integer? What about non-periodic signals? Thanks in advance.

## 2 Answers

I believe that you took this sentences from here: National Instruments - Windowing Signals. By "cycle" they mean Hz, such as 100 Hz = 100 cycles per second.

But what "integer" means? Well, simply numbers 1, 2, 3, etc. (no fractional component). Basically they are addressing the problem of spectral leakage. If for example you have a sinusoid with frequency 250 Hz, and you will take integer number of its periods, so after calculating the DFT your frequency bins are $0, 1, 2, ..., 250, ...$. Then peak from your signal will match exactly one of the frequency bins. In case it is not matched (for example 250.5 Hz, signal is same length yielding non-integer number of cycles), then you need to deal with spectral leakage - energy at this given frequency spreads across frequency bins on left and right (i.e. 250Hz and 251 Hz).

That's why we are also using time windows - to decrease effect of spectral leakage (errors is peaks amplitude).

• that means that if frequency is not integer,then signal has not integer number of cycle?i mean if at least one of frequency is fractional – dato datuashvili Mar 15 '14 at 19:31
• First thing you need to remember is that in digital domain frequency of sinusoid must be a rational number. If for example it happened that your fundamental frequency is 200.5 Hz, then you can avoid leakage if the length of your signal is appropriate, i.e. you are analysing this signal with fs = 1000 Hz. If it has 1000 samples, then you will have frequency bins with spacing of $500/1000=0.5 Hz$, so there is frequency bin at 200.5 Hz. Although if your signal is 9500 long, then bins are separated by 0.5263 Hz and you will not avoid leakage. – jojek Mar 15 '14 at 19:39
• aaa thanks very much,that means if i know frequency,i can always determine suitable length right? – dato datuashvili Mar 15 '14 at 19:47
• Well, you can - so that you have integer number of periods. Although it might work if your signal is a single sinusoid, but if you have lot's of harmonics spread differently, then it's not possible to make it for all of them (because we are in discrete domain) - that's why we are using windows. – jojek Mar 15 '14 at 19:49
• You are welcome. Nighty night ;) – jojek Mar 15 '14 at 19:54

With reference to FFT windowing of periodic signals, an integer number of cycles means that a signal repeats a whole number of times (3, 4, 5, etc.) within the FFT aperture, with no fractional remainder (3.1, 4.51, 5.99, etc.). For a frequency of X Hz, the FFT width in time would have to be some whole integer multiple of 1/X, which is the period of the signal.

FFT results that look like side-lobes will always appear for non-zero non-periodic signals. This is because the basis vectors of an FFT are only orthogonal between sinusoids that are exactly periodic in the FFT aperture.