3.5.21 · D3Guidance, Navigation & Control (GNC)

Worked examples — Kalman filter derivation — predict step, update step

3,074 words14 min readBack to topic

Before anything, one promise about notation. Every symbol below was defined in the parent note. To be safe, here is the pocket dictionary you will reuse in EVERY example:

Recall The quantities in plain words

(x-hat-minus) ::: our prediction of the hidden state, made before looking at the new measurement. The minus means "prior". ::: how uncertain that prediction is (a variance; bigger = shakier). The minus again means "prior". ::: the measurement the sensor just handed us. ::: how noisy the sensor is (variance of its error). ::: the dial that converts "state" into "what the sensor would read". If the sensor reads the state directly, . (state-transition) ::: the physics step — the rule that pushes the state forward one tick in time (e.g. "position += velocity × time"). If nothing moves, . (process noise) ::: how wrong the physics model itself is per step (a variance you add during predict). Bigger = you trust your own model less. (gain) ::: the blend weight — a number between and (in 1-D) saying how much of the surprise to believe. ::: the innovation (surprise): measurement minus prediction.


The scenario matrix

Every Kalman problem is one (or a mix) of the cells below. Each example is tagged with the cell it hits.

Cell What makes it special Where lands Example
A. Equal trust (exact midpoint) Ex 1
B. Great sensor (adopt measurement) Ex 2
C. Great prediction (ignore measurement) Ex 3
D. Degenerate: perfect sensor exactly, Ex 4
E. Degenerate: perfect prior , measurement rejected Ex 5
F. Predict grows uncertainty run predict, watch swell (no ; time update) Ex 6
G. Vector / correlated states matrices, off-diagonal is a matrix Ex 7
H. Limiting: steady state iterate to convergence stops changing Ex 8
I. Word problem (sensor fusion) real GPS + IMU numbers worked end-to-end Ex 9
J. Exam twist: measurement is scaled state gain must undo Ex 10

Prerequisites if any cell feels shaky: Covariance matrices and Gaussian distributions, State-space representation.


Cell A — Equal trust


Cells B & C — the two extremes of trust


Cells D & E — the two degenerate (zero-variance) cases

These are the "divide by zero" traps. Show them once and you'll never fear them.


Cell F — the predict step swells uncertainty


Cell G — vectors, matrices, and correlation (predict AND matrix-gain update)


Cell H — the limiting steady state


Cell I — the word problem (real sensor fusion)


Cell J — the exam twist ()


Recall Self-test

In Ex 3 the sensor shouted "50" and we barely moved — why? ::: Because its variance was huge; the trusted prior () kept the estimate near 0. Variances, not values, set the blend. Why does grow in Ex 6 but shrink in Ex 1? ::: Predict adds (uncertainty grows with no data); update multiplies by (a measurement removes uncertainty). In Ex 7 we measured position only — why did velocity get corrected? ::: Predict made position and velocity correlated (off-diagonal in ), so the gain carries a non-zero velocity entry. What single fact makes Ex 5 dangerous long-term? ::: forever after; the filter ignores all future data (divergence).

Related: Recursive Least Squares, Bayesian inference, Extended Kalman Filter (EKF), Unscented Kalman Filter (UKF).