Library
Mathematics

The Intuition of the Kalman Filter

A deep dive into the recursive nature of the Kalman filter, showing how it fuses imperfect predictions and noisy measurements to find the optimal state estimate.

Tracking a Moving CarTimePosition
State xk is hidden, measured as zk\text{State } x_k \text{ is hidden, measured as } z_k
Imagine you are tracking a car. You have a model that predicts its next position, but motion is messy and unpredictable. You also have a GPS sensor, but every reading is slightly noisy. How do you find the truth?
Step-by-step solver
1

(a) Setup

Define the state estimate and its variance to represent our current knowledge of the true value.

x^k,Pk\hat{x}_k, \quad P_k
2

(b) Predict

Project the state forward using the motion model, increasing uncertainty due to process noise.

x^k−=Fx^k−1+Buk,Pk−=FPk−1FT+Q\hat{x}_k^{-} = F\hat{x}_{k-1} + Bu_k, \quad P_k^{-} = FP_{k-1}F^{T} + Q
3

(c) Update

Calculate the difference between the actual measurement and our prediction (innovation), then use the Kalman Gain to blend them.

yk=zk−Hx^k−,x^k=x^k−+Kkyky_k = z_k - H\hat{x}_k^{-}, \quad \hat{x}_k = \hat{x}_k^{-} + K_k y_k
4

(d) Refine

Update the uncertainty estimate for the next cycle.

Pk=(I−KkH)Pk−P_k = (I - K_kH)P_k^{-}

Original question

explain how kalman filter works

Follow-up chat

Ask me anything about this lesson. I'll answer using what we just covered.