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