- Dead reckoning drifts: P = n·Q grows without end.
- GPS alone is centred on the truth but jumpy: variance R at every step.
- Predict moves the bell and widens it. Correct fuses it with the GPS and narrows it.
- Q and R set the gain. High R: smooth but laggy. High Q: jumpy.
- Dead reckoning. Walking with your eyes closed: add up the encoder's moves, x̂[n] = x̂[n−1] + u[n], where u[n] is the move the encoder reports. Each step adds Q to the variance, so σ grows like √n and the estimate drifts.
- GPS only. A friend calling out your position: z = x_true + w with variance R. No drift, because each reading has fresh noise. But two readings one step apart differ with variance 2R, so the track jumps.
- Predict. One step in the dark: x̂⁻ = x̂ + u, P⁻ = P + Q. Variances add, σ values do not.
- Correct. A quick peek: lesson 1's fusion rule with the prediction as sensor 1 and the GPS as sensor 2. The innovation z − x̂⁻ is the surprise, and K is the share of it we believe. The worked update: 35 m with P⁻ = 5, GPS 38 m with R = 9, gives K = 5/14, x̂ ≈ 36.07 m and P ≈ 3.21.
- The loop and tuning. P settles at a steady state where growth and shrink balance. Starting from P = 0, only the ratio Q/R moves the estimate. Start from the sensors' real variances.
Next lesson: the matrix Kalman filter
One number is not enough for most robots. They need position and velocity, or x and y, at the same time. Lesson 3 replaces the variance P with a covariance matrix, draws it as an ellipse, writes the motion as a state-space model, and runs the same predict and correct loop with matrices, on a rocket heading for Mars.
A preview of lessons 3 and 4
You just tracked one number. Real robots track several at once: position and speed, in 2D, from sensors that do not measure what you want directly. Here is where the course goes next.
Read along
This lesson follows the section "The One-Dimensional Kalman Filter" of the interactive article at kalmanfilter.steppeschool.com, where you can drag the noise sliders and press Play.
Examples
Example 1
Dead reckoning with σ_enc = 0.4 m per step, starting from a known position. What is σ after 100 steps?
Show solutionHide solution
Q = 0.16, so P = 100 · 0.16 = 16 and σ = 4 m. The ±2σ band is ±8 m.
Example 2
Do one full step: x̂ = 0 m, P = 3, u = 2 m, Q = 1, then the GPS reads z = 4 m with R = 4.
Show solutionHide solution
Predict: x̂⁻ = 2 m, P⁻ = 4. Gain: K = 4 / 8 = 0.5.
Correct: x̂ = 2 + 0.5 · (4 − 2) = 3 m, P = 0.5 · 4 = 2.
Example 3
You multiply both Q and R by 10. What happens to the estimate x̂, and what happens to the band?
Show solutionHide solution
Starting from P = 0, every P⁻ and P is also multiplied by 10, so K = P⁻/(P⁻ + R) does not change. The estimate is exactly the same.
The band is √P, so it gets √10 ≈ 3.16 times wider. The filter claims to be less sure, even though it is just as accurate.

Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.