If I have a signal as the one below, how would I go about finding the beginning and end of the two "major events" (illustrated by a green arrow where the event begins, and a red arrow where it ends)?
I've tried the method suggested in this answer, but it seems that no matter how much I play around with the lag
, threshold
and influence
variables, it either reacts to the tiny changes in the beginning, middle and end of the graph (where there are no major events), or it doesn't react at all.
I can't simply determine if the signal is above a fixed threshold, as the strength of the signal can vary, thus I need some way of detecting when the signal deviates a lot from the "background noise". Also, the signal can sometimes be in an overall trend, like in the graphs below.
I'm already applying a simple low- and high pass filter to the signal. What I would like to have is something like the orange signal in the chart below (I've drawn it manually just to illustrate).
You might try a couple things. Both of these options depend somehow on knowing the type of unusual event that is to be expected.
Say you know the events are typically 100 samples in length. Create this signal and examine the peaks.
indicator = filtfilt(ones(1, 100) ./ 100, 1, abs(signal));
This will look something like your orange signal.
Second, you might try examining the sample-to-sample variation in the signal.
indicator = abs(diff(signal));
If you really want to go all-out, try a 1D-convolutional neural network. This requires labeled training data.
来源:https://stackoverflow.com/questions/43666284/detect-major-events-in-signal-data