# Detect when signal starts oscillating

I have a signal which consists of oscillations riding on square waves as shown in the image below. I wish to detect the time at which oscillatory events occur (as shown by the red star).

Each square wave is a different height and the oscillatory sequences riding on each sqaure wave are not identical. Here I have zoomed in on a small chunk of one oscillation.

A second order low-pass butterworth filter with cutoff at 500 Hz can be used to clean the data if this is a useful preprocessing step.

How can non-stereotyped oscillations be detected in a signal like this? Thanks!

• What characteristics of the oscillation are known with confidence? – Cristobol Polychronopolis Mar 9 '20 at 19:26
• If the signal you want to keep and the oscillations are in different frequency bands, then you can do filtering just as you did. You'd choose the passband to be the band where the signal you want to keep is and the stopband is all other frequencies. It might turn out to be something like a passband filter – Engineer Mar 9 '20 at 19:42

oscillation if variance exceeds $$V_{min}$$ and max derivative is smaller than $$D_{max}$$.