# How can I detect when a signal deviates from a flatline?

I apologize if this is not the correct forum, but I thought I'd ask.

I have an array of signal samples and I want to detect (retroactively, once I have measured the time/magnitude values) if there are any spikes / deviations during a sampled real signal How would I do this intelligently?

I've been computing the mean of all my sets and the standard deviation and seeing if any of the individual samples greatly deviate from the mean, but I'm thinking there must be a more established method or approach

• This question might be more suitable for the DSP or the statistics stackexchanges. Commented Mar 14, 2014 at 0:35
• There are many established methods for outlier detection, as a search on that term will reveal. One established method is to find points more than X standard deviations away from the mean, which it sounds like you have tried. Perhaps you could add a plot of your data or some explanation of what problems you are having with this method.
– John
Commented Mar 14, 2014 at 0:48
• As @John says, there are straightforward approaches. We really need to understand what the "signal model" is for the data you are seeing. If it's just a constant, and then it changes, that's one thing. If it's time-varying and you want to figure out when it's varying differently that's something else.
– Peter K.
Commented Mar 14, 2014 at 1:39
• If you tell us what language you are using then perhaps we can already propose a library that will do the job. As you said, it is not an uncommon task. Commented Mar 14, 2014 at 14:41