0

I have some raw periodic data of an experiment over many cycles. In my analyzing I need only one cycle, but want to use the whole data array in order to gain accuracy. So I need to get MATLAB calculate not the absolute average (which is easy, using mean(data)) but the average value for each time (relative to the period, which I also don't know).

Any advice on how to do this? Thanks a lot!

idow09
  • 504
  • 1
  • 5
  • 15
  • Do you know what the actual period is for each cycle? Also, what is the sampling period for the data? If you know both of these, then it's pretty easy to split up the data into separate cells, then apply the mean for each cell and bring it all back together into one vector where each element tells you the mean for that period. – rayryeng May 14 '14 at 07:35

1 Answers1

1

You may be able to use a Fourier Transform to autodetect the cycle length. There is a simple demo for this using sunspot data that ships with Matlab. The idea is to use FFT to detect the periodicity of sunspot activity to be approx 11 years.

The demo is documented on this page, and you can run it by typing "sunspots" at the Matlab command line, or "help sunspots".

http://www.mathworks.co.uk/products/matlab/examples.html?file=/products/demos/shipping/matlab/sunspots.html

The applicability of this method depends very much on the kind of signal you are sampling - whether it is a repeating pattern with relatively minor variations, and whether you have a lot of cycles captured from which to infer the periodicity robustly but at least for the latter you state you have "many cycles" of data.

jcollomosse
  • 673
  • 3
  • 17