From: Mat Hunt on
Hi Greg,

Still not really getting you. I have a very formal training in terms of Fourier analysis, it was a pure maths course I did in my third year at university.

I think of a Fourier transform as a map essentially which is defined by:

F(k)=int_{-infinity}^{+infinity}f(x)e^{-ikx}dx

The inverse transform being defined as:

f(x)=1/(2*pi)*\int_{-infinity}^{+infinity}F(k)e^{ikx}dk

In my work I have calculated what F(k), I now need to find what f(x) is.

You said that I need to do fftshift(ifft(F(k)) to get f, now I tried to read your post to figure out what I need to do but I couldn't quite get it. Can you explain again as if I were a simpleton :o)

The thing with the residue calculus was just a way of testing if I got the correct answer or not.

Mat
From: Greg Heath on
On Jun 23, 6:58 am, "Mat Hunt" <hunt_...(a)hotmail.com> wrote:
> Hi Greg,
>
> Still not really getting you. I have a very formal training in terms of Fourier analysis, it was a pure maths course I did in my third year at university.
>
> I think of a Fourier transform as a map essentially which is defined by:
>
> F(k)=int_{-infinity}^{+infinity}f(x)e^{-ikx}dx
>
> The inverse transform being defined as:
>
> f(x)=1/(2*pi)*\int_{-infinity}^{+infinity}F(k)e^{ikx}dk
>
> In my work I have calculated what F(k), I now need to find what f(x) is.
>
> You said that I need to do fftshift(ifft(F(k)) to get f, now I tried to read your post to figure out what I need to do but I couldn't quite get it. Can you explain again as if I were a simpleton :o)

You said it. I didn't. ;>)

I repeat:

The MATLAB fft and ifft functions assume the nonnegative intervals x =
dx*(0:N-1) and k = dk*(0:N-1) corresponding
to the Fourier pair f(x) and F(k).

If f and F are considered periodic, fftshift yields the translation to
the "zero centered" bipolar intervals with
indexing

xb = dx * [-ceil((N-1)/2) : floor((N-1)/2)]
kb = dk * [-ceil((N-1)/2) : floor((N-1)/2)]

corresponding to the Fourier pair fb(xb) and Fb(kb).

ifftshift is the inverse of fftshift.

When N is even, fftshift and ifftshift yield
the same result.

However, when N is odd,

x = ifftshift(xb)
X = fft(x)
Xb = fftshift(X)

and to return

X = ifftshift(Xb)
x = ifft(X)
xb = fftshift(x)

The trick is to remember that fftshift will
"center" the waveform about the coordinate zero.

If in doubt type fftshift([-2:2]) into the command
line.

Hope this helps.

Greg

From: Greg Heath on
On Jun 23, 1:38 pm, Greg Heath <he...(a)alumni.brown.edu> wrote:
> On Jun 23, 6:58 am, "Mat Hunt" <hunt_...(a)hotmail.com> wrote:
>
> > Hi Greg,
>
> > Still not really getting you. I have a very formal training in terms of Fourier analysis, it was a pure maths course I did in my third year at university.
>
> > I think of a Fourier transform as a map essentially which is defined by:
>
> > F(k)=int_{-infinity}^{+infinity}f(x)e^{-ikx}dx
>
> > The inverse transform being defined as:
>
> > f(x)=1/(2*pi)*\int_{-infinity}^{+infinity}F(k)e^{ikx}dk
>
> > In my work I have calculated what F(k), I now need to find what f(x) is..
>
> > You said  that I need to do fftshift(ifft(F(k)) to get f, now I tried to read your post to figure out what I need to do but I couldn't quite get it. Can you explain again as if I were a simpleton :o)
>
> You said it. I didn't. ;>)
>
> I repeat:
>
> The MATLAB fft and ifft functions assume the nonnegative intervals x =
> dx*(0:N-1) and k = dk*(0:N-1) corresponding
> to the Fourier pair f(x) and F(k).
>
> If f and F are considered periodic, fftshift yields the translation to
> the "zero centered" bipolar intervals with
> indexing
>
> xb = dx * [-ceil((N-1)/2) : floor((N-1)/2)]
> kb = dk * [-ceil((N-1)/2) : floor((N-1)/2)]
>
> corresponding to the Fourier pair fb(xb) and Fb(kb).
>
> ifftshift is the inverse of fftshift.
>
> When N is even, fftshift and ifftshift yield
> the same result.
>
> However, when N is odd,
>
> x  = ifftshift(xb)
> X  = fft(x)
> Xb = fftshift(X)
>
> and to return
>
> X  = ifftshift(Xb)
> x  = ifft(X)
> xb = fftshift(x)

WHOOPS! Screwed up the notation.
Correction;

f = ifftshift(fb)
F = fft(f)
Fb = fftshift(F)

and to return

F = ifftshift(Fb)
f = ifft(F)
fb = fftshift(f)


> The trick is to remember that fftshift will
> "center" the waveform about the coordinate zero.
>
> If in doubt type fftshift([-2:2]) into the command
> line.
>
Hope this helps.

Greg

From: Mat Hunt on
Hi Greg,

I had a play with it and to be honest, I can't get the thing to work. I don't understand the need for something like the fftshift function. I expected (naively) that I would give the point at which I would want the function evaluated at. Looking at the definition of the Fourier transform, they have the ability to do this, yet they choose not to for some reason.

I looked at what fftshift did to -2:2 and I have to say that I really didn't understand why it was doing that.

I looked at the maximum and minimum of the vector I got after doing ifft and it didn't match up to how I got doing it another method. I think I am going to keep with my old method of computing the inverse Fourier transform as it gives sensible. I wanted to compare my method with matlab's inbuilt method but after all this messing around, it still doesn't work.

I shall mention this to the developers as something that they might like to comsider.

Thanks for your time.

Mat
From: Mat Hunt on
So can anyone give me a clear and simple methodology to go from a Fourier transformed function F(k), back to the original function at a point, x say? So this would be a single number? I would have thought the the people at matlab would have thought this one through.

Mat