Now that the theory has been covered, how do we actually implement a Kalman filter from a simple basics start?
This article is written thanks to some very good explanations by Tim Babb, Bilgin Esme, Linsday Kleeman, Matthew Rhudy, Roger Salguero and Keaton Holappa. (NOTE: many of the images are copyright of Bilgin Esme).
Some implementations in Excel: KalmanExample.xls; Kalman.xlsm
Some implementations in Simulink: Kalman Filter Implementation In Simulink
Some useful files: Kalman_Excel_Simulink.zip
Example Details & Assumptions
The simplified example system has a constant value but noisy readings.
It is a 1-D signal so every entity becomes a numerical value rather than a matrix. A = 1, H = 1
There is no control signal.
Below is a description of the equation simplifications and a recap of the symbology naming convention:
In the example we use the following measured values (zk):
at k = 1 ms
zk = 0.390
x_hat_k- = 0
Pk- = 1
Kk = 1 / (1 + 0.1) = 0.909
x_hat_k = 0 + 0.909 * (0.390 - 0) = 0.355
Pk = (1 - 0.909) * 1 = 0.091
at k = 2 ms
zk = 0.500
x_hat_k- = 0.355
Pk- = 0.091
Kk = 0.091 / (0.091 + 0.1) = 0.476
x_hat_k = 0.355 + 0.476 * (0.500 - 0.355) = 0.424
Pk = (1 - 0.476) * 0.091 = 0.048
[content]