MATLAB: Converting between zero padded and non zero padded FFT

fft

I have a signal, x = [1 2 3 4]. I have the fft(x) which is
10.0000
-2.0000 + 2.0000i
-2.0000
-2.0000 - 2.0000i
I want to get the fft for y = [1 2 3 4 0 0 0 0] which is
10.0000
-0.4142 - 7.2426i
-2.0000 + 2.0000i
2.4142 - 1.2426i
-2.0000
2.4142 + 1.2426i
-2.0000 - 2.0000i
-0.4142 + 7.2426i
How can get the fft of y from the fft of x?

Best Answer

In this simple case, you have just decreased the separation between adjacent DFT bins by a factor of 2.
y = [1 2 3 4 0 0 0 0];
ydft = fft(y);
ydft = downsample(ydft,2);
% or ydft = ydft(1:2:end);
That will be the same as
xdft = fft(1:4);
but in general, the above won't work.
Related Question