views:

83

answers:

2

When measuring the strength of a Wifi signal between two static points, the measurement constantly fluctuates due to environmental factors.

What is a good algorithm to use smooth out small fluctuations and detect significant changes? Exponential moving average?

+3  A: 

Some sort of low pass filtering usually works for things like this:

y[i] = alpha * x[i] + (1-alpha) * y[i-1]

where alpha is chosen based on the amount of smoothing desired. x contains the raw input samples and y contains the filtered result.

sizzzzlerz
Thanks. I found the low-pass filter with an alpha value = 0.1 or 0.05 to be a good smoothing function for data values between 0 and 100.
FreshCode
+1  A: 

Exponential moving average is a good way of estimating the current true value of the signal, which as you can see above has popped up under a number of disguises with a number of different justifications.

The problem of detecting significant changes is slightly different, and has been studied as part of statistical quality control. One simple tool for this is http://en.wikipedia.org/wiki/CUSUM. The wikipedia page tells you enough to implement this, but not how to set W in S[n+1] = S[n] + Min(0, S[n] + X[n] - W), or what value of S[n] means that it has detected something. You could search further than I have, look in texts such as "Introduction to Statistical Quality Control" by Montgomery, or just grab lots of data and see what works in real life.

I would start by setting W to be the average of the typical value of long term signal strength when everything is OK and the first value of long term signal strength that should make you actually do something, and then plot the results of this on historical data to see if it looks sane and, if so, what value of S[n] should make you actually do something. (X[n] is of course the raw measured signal strength).

mcdowella
I'm looking into CUSUM. Looks like it might be a good way to determine if an earlier gradual rise can be linked to other events.
FreshCode