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 trying to do a Fourier Transform of the following Data, but I'm completely stuck.

Here's what I've done so far:

data = Drop[data, 1];
dat = data /. {x_, y_, z_, w_} -> {x + y/12., 10 z};
ListLinePlot[Abs[Fourier[dat]], PlotRange -> {Automatic, {0, 40}}]

I don't understand why it keeps displaying this weird plot enter image description here

Anyone have any clue what I'm doing wrong? I'm just learning this Fourier thing so I'm real lost.

share|improve this question
1  
Try ListPlot[Abs[Fourier[dat]], PlotRange -> {Automatic, {0, 350}}] Result –  belisarius Mar 12 at 2:47

1 Answer 1

Fourier does not accept a list of {time, sample} pairs - if you give it a 2D list it will do a 2D transform. Therefore you need to use Fourier on just the list of samples. To get the correct frequency scale on the plot you can use DataRange.

data = Import["http://solarscience.msfc.nasa.gov/greenwch/spot_num.txt", "Table"];

dat = Rest[data] /. {x_, y_, z_, _} :> {x + y/12., 10 z};

n = Length[dat];
t = dat[[2, 1]] - dat[[1, 1]];
fourierdata = Abs @ Fourier[dat[[All, 2]]];

ListLinePlot[fourierdata[[;; 1 + n/2]],
 DataRange -> {0, 1/(2 t)},
 PlotRange -> {{0, 0.5}, {0, 10000}}]

enter image description here

share|improve this answer
    
+1 I can't figure out how I was able to avoid seeing DateRange in the docs. –  bobthechemist Mar 12 at 14:07

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.