How to calculate an average cycle data in MATLAB

1.5k Views Asked by At

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!

1

There are 1 best solutions below

0
On

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.