Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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...

share|improve this question
1  
I suggest including the code to produce list if you wish to quickly get helpful answers. –  Mr.Wizard Aug 5 at 16:37
    
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. –  bill s Aug 5 at 18:52
    
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. –  Jiles Aug 6 at 8:22
    
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. –  Jiles Aug 6 at 8:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.