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')
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.