I am trying to look for significant peaks/spikes and periodic changes or fluctuations in about 60 time series of synthetic data.

For example, in data1 below, there are two large peaks around points 8 and 46, and I would like to be able to quantitatively find peaks like those, even if not quite so exaggerated.

I'm also trying to look for periodicity in something like data2 and get the period/amplitude if possible.

I'm trying to use Fourier, but it's giving me some issues. It's not showing obvious spikes at all; it's very possible that I'm just using Fourier wrong, or that I shouldn't be using Fourier. So now I'm here. Does anyone know how I should be able to do this? Thank you!

data1={0,0,0,0.000961538,0.00308404,0.000946074,0.004020101,0.004048583,0.002070393,0.00260078,0.000633714,0.001686341,0.001239926,0.00199071,0.001218769,0,0.001264223,0.001207001,0.00119976,0.001162791,0,0.001054296,0.001402525,0.000917852,0,0.000417537,0,0.0003861,0.000365097,0.000347102,0.000344471,0.000333,0,0.000308833,0.000605694,0.000288101,0.00110957,0.000558036,0.001787995,0.000485201,0.000942063,0.001139991,0.001303215,0.002961709,0.002135093,0.00387311,0.003771644,0.001746586,0.002402763,0.001606308,0.001939595,0.001298364,0.001393566,0.000666815,0.001298842,0.001331558}; data2={0,0.00174216,0,0.002298851,0.001904762,0.001106195,0.003468208,0.002915452,0.004642526,0.002629273,0.003218021,0.003843198,0.00620155,0.005426357,0.010140406,0.003875969,0.003443526,0.00433526,0.004837595,0.007064868,0.003858521,0.001960784,0.006638503,0.004376368,0.003757381,0.004495504,0.004627249,0.004975124,0.002912621,0.003063457,0.007327586,0.005225653,0.005793226,0.005009107,0.005033557,0.00802139,0.006254599,0.005382131,0.007531107,0.007951654,0.007968127,0.007910929,0.010520637,0.012363636,0.012119826,0.012159934,0.012415131,0.014611237,0.014464802,0.017215343,0.018433818,0.016375,0.016557475,0.015978552,0.017170891,0.018142163}

EDIT: Originally omitted data1. Added those data.

  • $\begingroup$ Fourier transform gives you a frequency spectrum of your signal not, the position of peaks. A list given as the input to the Fourier is assumed to be one period of a periodic signal. Try function like FindPeaks, if it can be tuned to suit your needs. $\endgroup$ – ercegovac Feb 8 '17 at 17:04
  • $\begingroup$ Regarding period/amplitude, what amplitude are you interested in? Amplitude of individual spectral component or value of peaks in the signal? $\endgroup$ – ercegovac Feb 8 '17 at 17:20
  • $\begingroup$ This data2 has a clear upward trend. Not obvious what is wanted for a set like that (e.g. whether the trend should first be removed). If more information were provided about the desired outcome, type of data, and the like that would be helpful. $\endgroup$ – Daniel Lichtblau Feb 8 '17 at 18:24

Try the following:

ListPlot[Take[Abs[Fourier[data1 - Mean[data1]]]^2, {2, Length[data1]/2}], 
 Joined -> True, Mesh -> Full, PlotRange -> All]

Since the Fourier transform goes up to Nyquist frequency the two peaks that you refer to are around 8 and 23 (the 46 is its mirror version around the Nyquist frequency)

For the second one, it seems to be something around the point 14 (maybe!):

ListPlot[Take[Abs[Fourier[data2 - Mean[data2]]]^2, {2, Length[data1]/2}], 
 Joined -> True, Mesh -> Full, PlotRange -> All]
| improve this answer | |
  • $\begingroup$ I do not think Fourier transform is the best tool for that, at least not in the form you applied. It gives you frequency spectra not place of peaks. I do not see how those two are related. $\endgroup$ – ercegovac Feb 8 '17 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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