Why does an 8 point DFT behave differently from a 16 point?

I have a 50 Hz sine wave sampled at 1600 Samples/second.I'm computing the 16 point DFT.So my fundamental frequency is 100 Hz.

I then decimated the 1600 samples to 400 samples.I then computed the 8 point DFT using this.Now my fundamental component is 50 Hz.The second harmonic is 100 Hz.

I plotted the above two scenarios on matlab.In the first case (16 Point) the magnitude of the 100 Hz component is nearly 3.5.

In the second case (8 Point) the magnitude of the 100 Hz component is nearly zero.The magnitude of the 50 Hz component is nearly 4.

Why does this anomaly occur?

Thanks,

Jose

Here's the code for this

%----------------------------Sine Wave------------------------------%

f = 50;

t = 0:(1/1600):(1-(1/1600))

Signal = sin(2*pi*f*t);

subplot(3,1,1)

plot(t,Signal)

ylabel('Amplitude')

title('50 Hz Sine wave at 1600 samples/sec');

%-------------------16 Point DFT-----------------------%

DFT_app_16 = fft(Signal,16);

subplot(3,1,2)
stem((0:100:1500),abs(DFT_app_16))

ylabel('Magnitude')
title('16 Point DFT')

%---------------------8 Point DFT--------------------------%

Dec_Sample = [];

for i = 1:4:1597
Dec_Sample = [Dec_Sample ((Signal(1,i) + Signal(1,i+1) + Signal(1,i+2) + Signal(1,i+3))/4)]

end

DFT_app_8 = fft(Dec_Sample,8);

subplot(3,1,3)
stem((0:50:350),abs(DFT_app_8))

xlabel('Frequency(Hz)')
ylabel('Magnitude')

title('8 Point DFT')

• Could you add the Matlab code to clarify what you did? Dec 2, 2014 at 10:34

Your sin frequency is 50 Hz, but in your 16 point DFT there is no 50 Hz bin. There is a 0 Hz bin and a 100 Hz bin, and you can see that some of the signal power goes into both of them. This is a non-ideal way of capturing a 50 Hz tone.

The 8 point DFT has a 50 Hz bin, and you can see that it captures almost all of the signal power.

• Yes,But I want to know why in the 16 point DFT does the signal power get split between 0 Hz and 100 Hz? Ideally shouldn't both these frequency components be zero? Dec 2, 2014 at 11:16
• No. The signal power is going to go somewhere. The Fourier transform preserves energy, meaning that the transform will have the same energy as the original signal, so the energy has to go somewhere, it's just a matter of where. It goes mostly into the 0 Hz and 100 Hz bins because those are the closest to 50 Hz. Dec 2, 2014 at 11:21
• That pretty much answers my question.But is there any mathematical proof for this? Dec 2, 2014 at 11:25
• Mathematical proof of the energy preservation property of the Fourier transform, or something else? Dec 2, 2014 at 11:26
• @JoseKurian: Check out Parseval's theorem. Dec 2, 2014 at 12:27

The difference isn't in the DFT. The difference comes from the decimation. Lowering the sampling rate by 4 changes the bins.
Before decimation, and using a sampling rate of 1600, you end up with frequency bins that are 100Hz wide. Since 50Hz doesn't fit exactly, the energy for the 50Hz gets smeared across several bins.

After decimation, your sampling frequency is 400Hz. With an 8 point fft, the bins are then 50Hz wide. The full energy of the 50Hz signal is then contained entirely in one bin.

You could do an 8 point FFT on the signal before decimation, and you will see the smearing caused by the signal frequency being between bins just like you do with the 16 point FFT.

If you use a 32 point FFT instead of a 16 point, then the smearing will also go away - 32 bins at 1600 give bins 50 Hz wide.

Each FFT result bin represents a spectrum that is 2 bins wide to the nearest zeros, and actually infinitely wide (but tapered) if you include all the lesser Sinc function ripples. So any pure sine waves that are not exactly integer periodic in the FFT width will appear in all the FFT result bins, but mostly in the two nearest FFT result bins.

Your second graph is for a sine wave that is exactly integer periodic in the FFT width, and thus centered only in one bin, as the Sinc function just happens to be zero at all the other FFT result bins when the FFT width is an exact integer multiple of the sine wave's period.