3
$\begingroup$

I'm having trouble figuring out a way to analyze some simple data. When graphed, the data I have make a somewhat sinusoidal curve. What I want to do is to find the x-values of the maximum peaks of the sinusoidal curve. I then want to subtract each of these x-values from the last peak found and average these differences to obtain an average distance between peaks. Is there an easy way to do this with Excel, Mathematica, or MatLab (the programs I have available to me?).

Thanks in advance!!!

$\endgroup$
2
$\begingroup$

The first technique that comes to mind is cubic spline interpolation, which is good at approximating sinusoidal functions without suffering from Runge's phenomenon. Here's a visual of cubic splines applied to a similar problem:

Example of cubic spline interpolation

Matlab has an implementation documented here.

Once you have a representation for the underlying function you should be able to find the local maxima easily and take the differences you are looking for.

$\endgroup$

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.