How to estimate the period of a pulse train? I am trying to find the period of a pulse train like signal.

I have reviewed the following questions but I did not find a clear-cut answer to the problem, 12892, 16502, 6260.

I do not know the period nor the pulse width. I work with windows that will contain between 2 and 16 pulses. Pulses may vary in length but will usually be shorter than half the period. The signal may be noisy, although I would be happy with a solution for the case of the (relatively) clean signal. I can work out a minimal pulse width if it helps.

Here are plots of the type of signal I am working with.





I am primarily interested in the period of the signal. The analysis needs not to be online.

For the first example, I'm looking to find a result of about 136.5.

My first attempt was to look at the signal in the frequency domain. But a pulse train in time domain is also a pulse train in frequency domain. I got this plot for the clean signal.



Next I tried autocorrelation. I got the following:


It is much better. I need to get the value automatically though, and I'm not too sure how to find that second local maxima without introducing too much ad-hoc thresholds that may fail when there are more or less peaks in the window. Additionally, I'm looking for a floating point result.
Also, the autocorrelation for the noisy signal was much less clear cut, even after smoothing the input.

There is probably another approach by detecting the rising edges in time domain?

Question:


Is there a standard way to estimate the period of a pulse train?
If autocorrelation is the right approach, how to automatically find the floating point coordinate of the peak from the autocorrelation result without too many assumptions?
If all you need to estimate is the period of your pulse train then you can threshold the original waveform and work on the clean one by detecting the rising and falling edges.

An FFT based approach would return an average estimate of its "frame of observation" anyway whose accuracy would depend on the length of the frame. (that is, an average estimate of the buffer that is passed at its input)

If you are concerned about the noise, use a short moving average filter (for instance a length 3 or length 5) to smooth the curve prior to estimating and applying the threshold. If absolute timings are essential for your application don't forget to take into account the group delay of the filter.