I have a signal which is sampled in real-time. At every time interval I receive a value. I need to characterize this signal as active or inactive (to take priority in the control actions). By active it means that we observe big changes over a specific time-window.

One way to do it as I consider, is to keep a history of N samples and calculate the mean value and the standard deviation with an update algorithm. Based on the std I can say if it is inactive or not. The problem is that I have tens of thousands of signals and the sampling period is not the same on all of them. So, keeping a variable length sample history for all the signals will be difficult.

For the mean value I can use averaging with forgetting factor. The forgetting factor can be connected to the sampling period of each signal to have a similar observation window on all signals.

Now the question:

Is there any metric similar to averaging with forgetting factor that can give me the same information as std? It has to be low on memory usage and computationally light (since it's a real-time operation).

Any papers, books or references are welcome!

Thanks in advance.


1 Answer 1


Try something like this:

$\begin{eqnarray} \mu(n) &=& (1 - \alpha_1) \mu(n) + \alpha_1 x(n) \\ \bar{x}(n) &=& x(n) - \mu(n) \\ s(n) &=& (1 - \alpha_2) s(n) + \alpha_2 \bar{x}(n)^2 \\ \sigma(n) &=& \sqrt{s(n)} \\ \end{eqnarray}$

This is equivalent to sending your input signal to a 1-pole DC blocking high-pass filter with a pole at $\alpha_1$, then sending the result to a RMS detector whose response time is set by $\alpha_2$ - to measure how much the signal is wiggling once its central trend has been removed.

Observe that $\sigma(n)$ is consistent with the definition of the standard deviation.

  • $\begingroup$ Thanks a lot for the answer. The first averaging is the averaging with forgetting factor I mentioned. I tried to use the second one by myself but with the same parameter a (a1=a2). I was getting strange results (the resulting std deviation was very unresponsive when compared to the std deviation obtain by keeping history). I'll try as you suggested and I'll report back! $\endgroup$
    – electrique
    Sep 14, 2012 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.