I'm having trouble with the Fourier function at the moment. I'm solving a set of differential equations with NDSolve, then need to extract the spectrum associated with the curve below: enter image description here

So i use table to generate a list of data from the output of NDSolve, called 'list', and then use the following code to do generate the Fourier transform:

T = 800;
dt = T/(10000 - 1);
n = Length[list];
ssf = RotateRight[Range[-n/2, n/2 - 1]/(n dt), n/2];
fft = Fourier[list, FourierParameters -> {-1, 1}] // Chop;
Fourdata = Transpose[{ssf, Abs[fft]}];

this gives the spectrum:

enter image description here

it seems like something weird is happening at zero frequency, with a small discontinuity, and a line running along at zero for all frequencies. I've messed around with both the propagation time and time steps, but it doesn't seem to go away.

Does anyone have any insight into this?

Thanks in advance, Jake

PS. I hope i have included enough detail here, but let me know if you need more...

  • 2
    $\begingroup$ I suggest including the code to produce list if you wish to quickly get helpful answers. $\endgroup$ – Mr.Wizard Aug 5 '14 at 16:37
  • $\begingroup$ If you look at Fourdata, you'll see why both problems are happening. The list starts at 0, goes to 0.5, connects to -0.5 (this is the small line near zero) and then connects back to just before 0. So when you ListLinePlot, you have a connection between negative and positive values, and no connection between -small and 0. $\endgroup$ – bill s Aug 5 '14 at 18:52
  • $\begingroup$ Hi, thanks for the comment. I've checked the raw data in 'fft', it seems that the kink is actually in this half of the list, so I don't think its a problem in the joining of the 0->0.5 and -small->0.5. $\endgroup$ – Jiles Aug 6 '14 at 8:22
  • $\begingroup$ Also I'm not sure how insightful the code i use to generate the data would be, though I am pretty confident in the code. $\endgroup$ – Jiles Aug 6 '14 at 8:24

Browse other questions tagged or ask your own question.