03 / 15 · 60–90 min
Recover motion.
Where is the robot between two uncertain measurements?
Check my intuition
01 · Predict
Before changing the settings.
Scalar correction: predicted position 2 m, variance P = 4 m². The measurement is 7 m with R = 1 m². With K = P / (P + R), what is the corrected position?
A hint
K = 4 / 5. The correction adds K times the measurement–prediction difference.
02 · Experiment and compare
Put the model to the test.
6.0 s. True position: 7.20 m. Estimate: 6.41 ± 0.79 m (95 %). K = 0.08.
- Measurement RMSE
- 1.53 m
- Filter RMSE
- 0.75 m
- Estimated velocity
- 1.37 m/s
Read values as a table
| t (s) | Measured (m) | True (m) | Estimated (m) |
|---|---|---|---|
| 0.10 | -1.27 | 0.07 | -0.85 |
| 0.20 | -0.24 | 0.14 | -0.61 |
| 0.30 | -2.37 | 0.21 | -1.16 |
| 0.40 | -1.32 | 0.28 | -1.24 |
| 0.50 | -0.39 | 0.35 | -1.05 |
| 0.60 | 2.14 | 0.42 | -0.23 |
| 0.70 | 0.11 | 0.49 | -0.06 |
| 0.80 | -1.96 | 0.56 | -0.46 |
| 0.90 | -0.30 | 0.63 | -0.39 |
| 1.00 | -3.89 | 0.70 | -1.23 |
| 1.10 | 1.56 | 0.77 | -0.60 |
| 1.20 | 2.24 | 0.84 | 0.08 |
| 1.30 | 3.02 | 0.91 | 0.83 |
| 1.40 | 1.52 | 0.98 | 1.11 |
| 1.50 | 2.60 | 1.05 | 1.56 |
| 1.60 | 2.56 | 1.12 | 1.93 |
| 1.70 | 1.80 | 1.19 | 2.08 |
| 1.80 | -0.75 | 1.26 | 1.72 |
| 1.90 | 4.73 | 1.33 | 2.40 |
| 2.00 | 0.16 | 1.40 | 2.18 |
| 2.10 | 0.04 | 1.47 | 1.96 |
| 2.20 | 0.72 | 1.54 | 1.89 |
| 2.30 | 2.30 | 1.61 | 2.06 |
| 2.40 | 2.14 | 1.68 | 2.19 |
| 2.50 | 1.16 | 1.75 | 2.15 |
| 2.60 | 0.11 | 1.82 | 1.97 |
| 2.70 | 1.46 | 1.89 | 1.99 |
| 2.80 | 2.42 | 1.96 | 2.13 |
| 2.90 | 1.60 | 2.03 | 2.15 |
| 3.00 | 2.41 | 2.10 | 2.27 |
| 3.10 | 5.10 | 2.18 | 2.70 |
| 3.20 | 0.28 | 2.26 | 2.51 |
| 3.30 | 3.48 | 2.36 | 2.72 |
| 3.40 | 1.87 | 2.48 | 2.71 |
| 3.50 | 2.51 | 2.60 | 2.78 |
| 3.60 | 3.24 | 2.74 | 2.92 |
| 3.70 | 3.58 | 2.88 | 3.08 |
| 3.80 | 5.92 | 3.04 | 3.47 |
| 3.90 | 4.51 | 3.22 | 3.68 |
| 4.00 | 1.81 | 3.40 | 3.60 |
| 4.10 | 1.89 | 3.59 | 3.53 |
| 4.20 | 3.51 | 3.78 | 3.62 |
| 4.30 | 1.89 | 3.97 | 3.55 |
| 4.40 | 3.88 | 4.16 | 3.67 |
| 4.50 | 4.47 | 4.35 | 3.83 |
| 4.60 | 2.80 | 4.54 | 3.82 |
| 4.70 | 6.49 | 4.73 | 4.15 |
| 4.80 | 4.46 | 4.92 | 4.28 |
| 4.90 | 5.91 | 5.11 | 4.52 |
| 5.00 | 2.29 | 5.30 | 4.42 |
| 5.10 | 6.09 | 5.49 | 4.66 |
| 5.20 | 5.82 | 5.68 | 4.86 |
| 5.30 | 5.51 | 5.87 | 5.02 |
| 5.40 | 3.99 | 6.06 | 5.04 |
| 5.50 | 4.75 | 6.25 | 5.11 |
| 5.60 | 6.99 | 6.44 | 5.37 |
| 5.70 | 7.65 | 6.63 | 5.67 |
| 5.80 | 7.37 | 6.82 | 5.93 |
| 5.90 | 8.31 | 7.01 | 6.24 |
| 6.00 | 6.68 | 7.20 | 6.41 |
Understand the calculations
03 · Connect the diagram to calculations
The numbers behind motion.
The state contains position and velocity. The filter predicts constant velocity; the simulated robot accelerates between 3 and 4 s, then between 6 and 7.2 s. The filter does not know these accelerations.
x = [position, velocity]ᵀ ; Δt = 0.1 s
F = [[1, Δt], [0, 1]] ; H = [1, 0]
Q = q × [[Δt⁴/4, Δt³/2], [Δt³/2, Δt²]]
R = (assumed noise)²
K = P⁻Hᵀ / (H P⁻ Hᵀ + R)
x̂ = x̂⁻ + K(z − H x̂⁻)Q represents random acceleration constant within each step and independent across steps. The ±1.96 σ band is model-predicted uncertainty, not a guarantee under unmodelled accelerations. RMSE is the square root of the mean squared error over displayed time steps.
A few lines to reconstruct
gain = predicted_variance / (predicted_variance + measurement_variance)
corrected = prediction + gain * (measurement - prediction)The notebook provides one function per laboratory, hand-calculated examples and tests. Exercises isolate components; these pages run the complete simulations.
Keep an observation
04 · Record
What changed?
Compare two settings. Record the effect, your explanation and a case where the model might fail. Saving keeps the current settings and seed, not a certification of competence.
atomsh / lab