sinusoidal oscillations - average period

Post here first, or if you can't find a relevant section!
Post Reply
Posts: 161
Joined: Thu Mar 02, 2017 12:32 pm

sinusoidal oscillations - average period

Post by acronis » Thu Nov 16, 2017 1:31 pm

Hello .

There is an array of records sinusoidal oscillations (approximately ten waves).
Could you tell me the simplest algorithm to calculate the average period.

For example, I found the first the highest point of the first wave, how to find the highest point of the second wave ?
as there is the right thing to do ?

Posts: 11
Joined: Sun Oct 02, 2016 11:40 pm

Re: sinusoidal oscillations - average period

Post by MarkB » Thu Nov 16, 2017 2:39 pm

If it's a zero centered sine wave, looking for zero crossings is better than looking for peaks because the slope is at its maximum there, hence less measurement uncertainty. If it's not zero centered then take the mean of the waveform, subtract that, and it's approximately zero centered.

If the signal has significant noise on top of the fundamental sinusoid there may need to be "sanity checking" to mitigate the potential for multiple zero crossings per cycle. This might take the form of rejecting zero crossings that are too close together based on a priori knowledge or based on the measurements of other cycles.

User avatar
Posts: 2197
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta

Re: sinusoidal oscillations - average period

Post by mrburnette » Thu Nov 16, 2017 10:51 pm

As MarkB stated, it is better to work out the zero-crossing. A visual may help:

Lots more approaches via Google


Posts: 19
Joined: Thu Oct 26, 2017 11:45 pm

Re: sinusoidal oscillations - average period

Post by gilhad » Sat Nov 18, 2017 3:54 am

It all depends on quality of the signal (how much noise is there). I would start by having graph of some samples, just to visually see, how it looks - if it is "mainly sinus with some rounding errors", then it is easy - divide ovelall time by count of zero crossing (not just zeroes, as it can have like -0.3;-0.1;+0.1;+0.3 sequences)

If it is not zero centered, I woul use a "mean" as center (half numbers are higher, half lower then this) rather than "average" (sum divided by count), as one really high peak can move average above all other values.

If there is a little noise around zero ( -0.3, -0.1, +0.1, -0.1, +0.1, +0.3, +0.1, +0.5 ...) then I would collect lenhgts above zero and legnths below zero, then discarted all short values, leaving only those long and count that long. (say if it is not much wild, then discard anything shorter then 1/5 of average and it should be good)

If it is more noise than signal, then count moving averages to make the oscilation somehow "fluent" and then count the period as above.

It would really help to know, how long the period "should be" if it is in hertz, kilohertz or megahertz so to discard noise, not the signal (again graphical helps a lot) - if you have sound of 50Hz modulated by 1kHz, do you need value like 40-60Hz, or value like 0.8-1.2kHz? ( something like or just google "sound wave" pictures)

Post Reply