help-octave
[Top][All Lists]

## Re: inverse fourier transform

 From: Heber Farnsworth Subject: Re: inverse fourier transform Date: Wed, 2 Apr 2003 10:52:17 -0600

Something seems wrong about this. Why does the function need to be symmetric for ifft to give a real answer? On some level this makes sense because I know that even functions have real transforms. But I know this function is not even (for those with experience in statistics I have a distribution which is skewed). But the distribution is real. Why can't I do an inverse transform to recover the distribution from it's fourier transform?
```
```
I looked more closely at the fourier transform which I'm trying to invert. I call it phi.
```
plot(real(fftshift(phi)))

It's real part is symmetric (even)

plot(imag(fftshift(phi)))

and it's imaginary part is odd (looks just like sin on [-pi:pi])

Heber

On Wednesday, April 2, 2003, at 01:07 AM, Quentin H. Spencer wrote:

```
```Heber Farnsworth wrote:

```
Some of you will laugh at me for this but I've never done an inverse fourier transform. I need to use a probability density function which I don't know in closed form but I do have a closed form for it's characteristic function (fourier transform). But when I try ifft I get something that is complex. I know that this thing is the fourier transform of a real density. How do I get a real (not complex) thing out of this? Here some things I'm not sure about which may be causing my confusion.
```
```
1. I'm not sure what range of frequencies to use: [-pi,pi]? something else?
```
2.  I may not be using fftshift correctly.
```
```
This is possible. Misalignment by one sample is enough to cause
problems. You do want to choose frequencies from [-pi,pi], and assuming
```
you want real output, you need the function to be symmetric around 0. If
```you are doing, say, a 64 point IFFT, index 1 is DC, and index 33 is
Nyquist (pi and -pi), so indices [2:32] must be a mirror image of
indices [34:64] in order for the IFFT to be real. Because of machine
precision, you will always get complex output, so after you verify that
the imaginary part is just noise, you can ignore it.

```
```
```
Is there anyone out there that does this a lot that can give me some pointers?
```
Heber Farnsworth

```
```

```
```

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```