From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Confusion over calculating Fourier transforms
Date: Wed, 2 Dec 2009 15:51:03 +0000 (UTC)
Organization: Xoran Technologies
Lines: 13
Message-ID: <hf62d6$k7a$>
References: <hf5c3c$1f5$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1259769063 20714 (2 Dec 2009 15:51:03 GMT)
NNTP-Posting-Date: Wed, 2 Dec 2009 15:51:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:589537

"Mat Hunt" <> wrote in message <hf5c3c$1f5$>...
> Hi,
> I need to calculate the Fouier transform of some rather complicated functions. Naively, I would do the following (to compute the Fourier transform of a Gaussian say):
> >x=-3:0.001:3;
> >y=exp(-x.^2);
> >f=abs(fft(y));
> >plot(f);
> I just set something which is completely wrong, what am I doing wrong here?

You need to do plot(fftshift(f)) to see the Gaussian as a centered peak (it will be very narrow, so you'll need to zoom in). Right now, you're seeing a circulant shift of this peak.