Frequency Transform is used to study a signal’s frequency domain characteristics. When using FFT to study the frequency domain characteristics of a signal, there are two limits : 1) The detectability of a small signal in the presence of a larger one ; 2) frequency resolution – which distinguishes two different frequencies.

In practice, the measured signals are limited in time and the FFT calculates the frequency transform over a certain number of discrete frequencies called bins.

### Spectral Leakage:

In reality, signals are of time-limited nature and nothing can be known about the signal beyond the measured interval. For example, if the measurement of a never ending continuous train of sinusoidal wave is of interest, at some point of time we need to terminate our observation to do further analysis. The limit on the time is also posed by limitations of the measurement system itself (example: buffer size), besides other factors.

It is often said that the FFT implicitly assumes that the signal essentially repeats itself after the measured interval and hence the FFT assumes the signal to be continuous (conceptually, juxtapose the measured signal repetitively). This lead to glitches in the assumed signal (see Figure 1). When the measurement time is purposefully made to be a non-integral multiple of the actual signal rate, these sharp discontinuities will spread out in the frequency domain leading to spectral leakage. This explanation for spectral leakage need to be carefully investigated.

## Experiment 1: Effect of FFT length and frequency resolution

Consider a pure sinusoidal signal of frequency \(f_x = 10 \;Hz\) and to represent in computer memory, the signal is observed for \(1\) second and sampled at frequency \(F_s=100 \; Hz\). Now, there will be \(100\) samples in the buffer and the buffer will contain integral number of waveform cycles (\(10\) cycles in this case). The signal samples are analyzed using N-point DFT. Two cases are considered here for investigation : 1) The FFT size \(N\) is same as the length of the signal samples, i.e, \(N=100\) and 2) FFT size set to next power of 2 that fits the signal samples i.e, \(N=128\). The result are plotted next.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Fx=10; %Frequency of the sinusoid Fs=100; %Sampling Frequency observationTime = 1; %observation time in seconds t=0:1/Fs:observationTime-1/Fs; %time base x=sin(2*pi*Fx*t);%sampled sine wave N=100; %DFT length same as signal length X1 = 1/N*fftshift(fft(x,N));%N-point complex DFT of x f1=(-N/2:1:N/2-1)*Fs/N; %frequencies on x-axis, Fs/N is the frequency resolution N=128; %DFT length X2 = 1/N*fftshift(fft(x,N));%N-point complex DFT of x f2=(-N/2:1:N/2-1)*Fs/N; %frequencies on x-axis, Fs/N is the frequency resolution figure; subplot(3,1,1);stem(x,'r') title('Time domain');xlabel('Sample index (n)');ylabel('x[n]'); subplot(3,1,2);stem(f1,abs(X1)); %magnitudes vs frequencies xlim([-16,16]);title(['FFT, N=100, \Delta f=',num2str(Fs/100)]);xlabel('f (Hz)'); ylabel('|X(k)|'); subplot(3,1,3);stem(f2,abs(X2)); %magnitudes vs frequencies xlim([-16,16]);title(['FFT, N=128, \Delta f=',num2str(Fs/128)]);xlabel('f (Hz)'); ylabel('|X(k)|'); |

One might wonder, even though the buffered samples contain integral number of waveform cycles, why the frequency spectrum registered a distinct spike at \(10 \; Hz\) when \(N=100\) and not when \(N=128\). This is due to the different frequency resolution, the measure of ability to resolve two different adjacent frequencies

For case 1, the frequency resolution is \(\Delta f = f_s/N = 100/10 = 1 Hz\). This means that the frequency bins are spaced \(1 \; Hz\) apart and that is why it is able to hit the bull’s eye at \(10 \; Hz\) peak.

For case 2, the frequency resolution is \(\Delta f = f_s/128 = 100/128 = 0.7813 Hz\). With this frequency resolution, the x-axis of the frequency plot cannot have exact value of \(10 \; Hz\). Instead, the nearest adjacent frequency bins are \(9.375 \; Hz\) and \(10.1563 \; Hz\) respectively. Therefore, the frequency spectrum cannot represent \(10\;Hz\) and the energy of the signal gets leaked to adjacent bins, leading to \(spectral \; leakage\).

## Experiment 2: Effect of time-limited observation

In the previous experiment, the signal wave observed for \(1\) second duration and that fetched whole \(10\) cycles in the signal buffer. Now, reduce the observation time to \(0.91\) second and re-run the same code, results below. In this case, the signal buffer will have \(9.1\) cycles of the sinewave, which is not a whole number. For case 1, the frequency resolution is \(1 \; Hz\) and the FFT plot has registered a distinct peak at \(10 Hz\). Careful investigation of the plot will reveal very low spectral leakage even in case 1 (observed the non-zero amplitude values for the rest of the bins).This is primarily due to the change in the observation interval leading to non-integral number of cycles within the observed window. The spectral leakage in case 2, when \(N=128\), is predominantly due to mismatch in the frequency resolution.

From these two experiments, we can say that

1) The mismatch between the tone of the signal and the chosen frequency resolution (result of sampling frequency and the FFT length) leads to spectral leakage (experiment 1).

2) Time-limiting an observation (at inappropriate times), may lead to spectral leakage (experiment 2).

3) Hence, the spectral leakage from a larger signal component, if present, may significantly overshadow other smaller signals making them difficult to identify or detect.

### Reference

### External Resources:

[1] DFT,FFT and IFFT – applied to music analysis

[2] Fast Fourier Transform – FFT and Matlab examples

[3] FFT/IFFT Block Floating Point Scaling – Altera

**Rate this article:**

**Recommended Signal Processing Books**

**Articles in this series:**

How to Interpret FFT results – complex DFT, frequency bins and FFTShift

How to Interpret FFT results – obtaining Magnitude and Phase information

FFT and Spectral Leakage

How to plot FFT using Matlab – FFT of basic signals : Sine and Cosine waves

Generating Basic signals – Square Wave and Power Spectral Density using FFT

Generating Basic signals – Rectangular Pulse and Power Spectral Density using FFT

Generating Basic Signals – Gaussian Pulse and Power Spectral Density using FFT

Chirp Signal – Frequency Sweeping – FFT and power spectral density

Constructing the Auto Correlation Matrix using FFT

Pingback: Spectral Leakage II | Israel Vaughn()

Pingback: Estimation of Impulse Response of a LTI System » GaussianWaves()

Pingback: Generating Basic signals – Square Wave and Power Spectral Density using FFT » GaussianWaves()

Pingback: Generating Basic signals – Rectangular Pulse and Power Spectral Density using FFT » GaussianWaves()

Pingback: Generating Basic Signals – Gaussian Pulse and Power Spectral Density using FFT » GaussianWaves()

Pingback: Chirp Signal – Frequency Sweeping – FFT and power spectral density » GaussianWaves()

Pingback: Interpreting FFT results – obtaining magnitude and phase information » GaussianWaves()

Pingback: Constructing the Auto Correlation Matrix in Matlab » GaussianWaves()

Pingback: Interpreting FFT results – complex DFT, frequency bins and FFTShift » GaussianWaves()

Pingback: Analyse spectrale – comparaison “FFT” et “PFB” (polyphase filter bank) | F4GKR()

Pingback: SPECTRAL LEAKAGE II - maxwell's muse, llc()

Pingback: Simulation and Analysis of White Noise in Matlab | GaussianWaves()

Pingback: How to plot FFT using Matlab – FFT of basic signals : Sine and Cosine waves | GaussianWaves()

Pingback: Computation of Power of a Signal in Matlab()

Pingback: Colored Noise Generation in Matlab | GaussianWaves()

Pingback: Window Functions – An Analysis | GaussianWaves()