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

Filtering with MATLAB's ifftshift

356 views
Skip to first unread message

Greg Heath

unread,
May 15, 2010, 9:24:13 AM5/15/10
to
The MATLAB fft is defined over the nonnegative
time interval
t = dt*(0:N-1);
t = 0:dt:T-dt;
t = linspace(0,T-dt,N);
where
dt = 1/Fs
and
T = N*dt
is the temporal period (corresponding discrete
time period is N) induced by ifft(fft(x))

When xb is defined over the "centered" bipolar time
interval
tb = t - dt*ceil((N-1)/2);
= dt*[-ceil((N-1)/2) : floor((N-1)/2))];
the location of the negative time components can be
periodically shifted N units into the proper positive
time interval location by using ifftshift
x = ifftshift(xb);
and recovered by using the inverse fftshift
xb = fftshift(x);

X = fft(x) yields a transform with a spectral
period Fs (discrete frequency period N) that is
defined over the nonnegative frequency interval
f = df*(0:N-1);
f = 0:df:Fs-df;
f = linspace(0,Fs-df,N);
where
df = 1/T = Fs/N

Xb, the "centered" bipolar frequency transform
defined over the spectral interval
fb = f - df*ceil((N-1)/2)
= df*[-ceil((N-1)/2) : floor((N-1)/2))];
is obtained by using fftshift
Xb = fftshift(X)
and X is recovered using ifftshift
X = ifftshift(Xb)

If a time signal xb is defined over the
centered bipolar time interval and is
filtered using a transform, Hb, that is defined
over the centered bipolar frequency interval,
the resulting output, yb can be obtained in 7
steps:
xb => x => X => Xb => Yb = Hb.*Xb => Y
=> y => yb
which, of course are typically combined by the
experienced user.

Note that ifftshift is identical to fftshift
when N is even

Hope this helps.

Greg

Dave Robinson

unread,
May 15, 2010, 1:45:06 PM5/15/10
to
Greg Heath <he...@alumni.brown.edu> wrote in message <e48ebf08-396a-42de...@p17g2000vbe.googlegroups.com>...

Ok Greg, now we know what the answer is, what was the question? ;-)

Regards

Dave Robinson

Greg Heath

unread,
May 15, 2010, 2:23:57 PM5/15/10
to
On May 15, 1:45 pm, "Dave Robinson" <dave.robin...@somewhere.biz>
wrote:
> Greg Heath <he...@alumni.brown.edu> wrote in message <e48ebf08-396a-42de-8fe5-bedf08c96...@p17g2000vbe.googlegroups.com>...

The question is posed in

Newsgroups: comp.soft-sys.matlab
From: "Nicolas " <nico_spect...@hotmail.com>
Date: Sat, 15 May 2010 00:36:04 +0000 (UTC)
Local: Fri, May 14 2010 8:36 pm
Subject: FFT-filter-IFFT problem

http://groups.google.com/group/comp.soft-sys.matlab/msg/5ea90824ec15e2f5?hl=en

My reply to him was to refer to this thread.

Since many other posters have had problems with MATLAB
concerning

a. negative times and frequencies using fft/ifft
b. zero matrix indices
c. ifftshift vs fftshift

I felt that this was the best way to respond.

Hope this helps.

Greg

0 new messages