Applying a Kalman filter to a WiFi power signal

I have created an app that uses the power of a WiFi signal to determine distance to the WiFi access point. Problem with that power reading is that it is not very stable. I have been looking into filtering techniques and a Kalman filter seems perfect, albeit not trivial.

Could you help me create a model or give some hints on the use of the Kalman filter to filter out the noise?

• Is wiki so trivial for the start? – Caran-d'Ache Jan 1 '14 at 14:27
• also i think cross validated might be more suitable for this question. – Lost1 Jan 1 '14 at 14:34
• Well, I found an implementation that needs a process and measurement model. I have no idea where to start to create these models. – Bart Friederichs Jan 1 '14 at 14:47

Kalman filter can be explained in these simple terms:

1) It assumes that you have a probabilistic model for how system changes with time. In your case how the power of the source changes. From what you tell me, for a stationary source, you can assume this to be constant.

2) It assumes how the measurement system works. For example, you may assume that the received power follows inverse squared law. Note, if either the source or the detector moves, then you have to model the motion as part of (1) above. Probabilistically you can assume that the jerk (change in acceleration) is a zero mean random variable.

3) You have a probabilistic model in your measurement errors.

In your case, if you assume a stationary source and stationary detector, then you can assume nothing changes in the system. In this case Kalman filter reduces to least squares solution. So you just average the last $N$ measured values, or use some form auto regression. If $P$ is the measured power, and $\hat P$ is the filtered value, then a simple recursive formula which you update at every measurement: $$\hat P = \hat P + \theta (P -\hat P),~~ 0 \le \theta \le 1$$ where $\theta$ is a measure of how much you trust the measurement. Note that if $\theta = 1$ then there is no filtering $\hat P = P$. If $\theta =0$ then measurement is rejected (no change in $\hat P$). You can change $\theta$ from one measurement if you have an independent way to asses the confidence in the measurement.

• Thanks for getting me started. I'll have to dust off my math skills I guess. – Bart Friederichs Jan 1 '14 at 15:12

http://www.amazon.co.uk/Kalman-Filter-Beginners-MATLAB-Examples/dp/1463648359/ref=sr_1_1?ie=UTF8&qid=1388589013&sr=8-1&keywords=Kalman+filter

this book gives nice examples with code (in Matlab)

The book is very easy to understand.