# How to detect the edges of periodic signal?

I have a periodic signal generated by accelerometer sensor and I need to count the number of peaks. However, I can't predict when the periodic sequence starts and ends. What would be the best way to do this if expected frequency of the useful signal is between 0.2Hz - 5Hz?

Here is the example of the signal - five squats. • Are you sampling the sequence? If so, at what rate? That is, how many samples per second? Does the signal repeat periodically (if so, do you know the period?) or does periodic signal mean that the signal "looks" like a (possibly decaying) sinusoidal signal of frequency between $0.2$ and $5$ Hz preceded by a brief start-up transient, (and you don't know when it starts up)? And what you would like to detect and count the number of peaks in the signal? – Dilip Sarwate Nov 26 '12 at 12:47
• Do you mean that you don't know how long the period is? – Jim Clay Nov 26 '12 at 13:15
• The sampling rate is 50Hz and I'm trying to calculate the repetitions in pushups, squats etc... That's why I'm assuming periodic signal with this kind of frequency. Yes. There is a transient period at the start and at the end, that I can't control, i.e. when person activates the sensor and lays down on the floor. – Mykola Pavlov Nov 26 '12 at 13:20
• @JimClay I can't control the duration of overal process. However, the frequency of useful signal is limited to the nature of the physical exercises. I'm assuming that 0.2 to 5 Hz is more than enough. – Mykola Pavlov Nov 26 '12 at 13:25
• @NikolayPavlov Okay, so you are counting push-ups and the like. I would call that "sort of" periodic because the period between push-ups can change. I would call this a straightforward peak detection problem where you have to detect multiple peaks. This thread might help- dsp.stackexchange.com/questions/1302/peak-detection-approach – Jim Clay Nov 26 '12 at 14:36