On Tue, Jul 29, 2008 at 8:56 AM, Felix Richter <felix@physik3.uni-rostock.de> wrote:
> I quickly copy-pasted and ran your code; it looks to me like the results
> you calculated analytically oscillate too fast to be represented
> discretely.  Did you try to transform different, simpler signals?  (e.g. a
> Gaussian?)
Yes, I run into the same problem.

Since the oscillation frequency is given by the point around which the
function is centered, it would be good to have it centered around zero.
The FFT assumes the x axis to be [0..n], so how should I do this?
The functions I have to transform later won't be symmetrical, so the trick
abs(fftdata) is not possible.

You can apply a linear phase shift to the transformed data, i.e., multiply by something of the form exp(ixn), where x depends on where you want the center and n is the index of the transformed data point. This effectively rotates the original data. Or you can just rotate the data. If the data is not symmetric you are always going to have complex components. What exactly are you trying to do? I mean, what is the original problem that you are trying to solve by this method?