Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FFT, zero padding and IFFT

878 views
Skip to first unread message

Samuele

unread,
Jul 16, 2012, 3:09:08 AM7/16/12
to
Hello Everybody,
I have a question corning the zero padding and the FFT. I learned a couple of years ago that if I zeropad a vector in frequency domain and I come back in time domain, the vector in time domain is interpolated (i.e between the original samples I added samples that are "average" between two samples).

My question is the following, why if I run this example (FFT, zero padding, IFFT) I always obtain a complex signal instead of obtaining the original signal interpolated??

v = [1 2 3 4];
fv = fft(v);
fvzp = [fv 0 0 0 0];
vzp = ifft(fvzp)
vzp =

Columns 1 through 4

0.5000 1.2500 - 0.2500i 1.0000 1.2500 - 0.4571i

Columns 5 through 8

1.5000 1.2500 - 0.2500i 2.0000 1.2500 + 0.9571i

Thanks,

Samuele

Idin Motedayen-Aval

unread,
Jul 16, 2012, 11:27:32 AM7/16/12
to
Hi Samuele,
"The discrete Fourier transform of a real-valued signal is conjugate
symmetric."
When you zero-pad your FFT, it's no longer conjugate symmetric, so its
IFFT cannot be a real-value signal.

And this is in fact interpolating your signal. Just for kicks, try this:
v = [0 1 2 3 4];
fv = fft(v);
fvzp = [(fv) zeros(1,200)];
vzp = ifft(fvzp);
plot(abs(vzp))

(this is an "interpolate" version of your signal, and scaled to keep its
total energy the same).
--
Idin Motedayen-Aval
The MathWorks, Inc.
zq=[4 2 5 -15 -1 -3 24 -57 45 -12 19 -12 15 -8 3 -7 8 -69 53 12 -2];
char(filter(1,[1,-1],[105 zq])), clear zq


Greg Heath

unread,
Jul 16, 2012, 10:19:08 PM7/16/12
to
Idin Motedayen-Aval <run.si...@MATLAB.for.email> wrote in message <ju1bt4$mg0$1...@newscl01ah.mathworks.com>...
> Hi Samuele,
> "The discrete Fourier transform of a real-valued signal is conjugate
> symmetric."
> When you zero-pad your FFT, it's no longer conjugate symmetric, so its
> IFFT cannot be a real-value signal.
>
> And this is in fact interpolating your signal. Just for kicks, try this:
> v = [0 1 2 3 4];

Note:

1. length(v) = 5 is odd
2. The 100% discontinuity in the periodic extension of v. This can cause Gibbs Phenomena
effects.

> fv = fft(v);
> fvzp = [(fv) zeros(1,200)];

No! This is not conjugate symmetric.

Hope this helps.

Greg

Bruno Luong

unread,
Jul 16, 2012, 11:42:20 PM7/16/12
to
"Samuele " <samue...@hotmail.com> wrote in message <ju0emk$3j0$1...@newscl01ah.mathworks.com>...
> Hello Everybody,
> I have a question corning the zero padding and the FFT. I learned a couple of years ago that if I zeropad a vector in frequency domain and I come back in time domain, the vector in time domain is interpolated (i.e between the original samples I added samples that are "average" between two samples).

You should pad in the high frequencies, which are located in the middle of the output of the fft, not the tail of it.

% Example data
n = 100;
x=linspace(-3,3,n);
y=1./((x-0.5).^2+1);
z = fft(y);

% Pad the high frequency
padsize = 28/2;
if mod(length(z),2) % odd
zp = ifftshift([zeros(1,padsize) fftshift(z) zeros(1,padsize)]);
else % even
zp = fftshift(z);
zp(1) = zp(1)/2;
zp(end+1) = zp(1);
zp = ifftshift([zeros(1,padsize) zp zeros(1,padsize-1)]);
end

% Resampling, renormalization
xp = linspace(x(1),x(end),length(zp));
yp = ifft(zp)/length(z)*length(zp);

% Check
figure()
plot(xp,yp,'b',x, y,'r')

% Bruno

Samuele

unread,
Jul 17, 2012, 7:09:16 AM7/17/12
to
Thanks guys for the help, now it's clear !! :) :)

Samuele


"Bruno Luong" <b.l...@fogale.findmycountry> wrote in message <ju2mus$5im$1...@newscl01ah.mathworks.com>...
0 new messages