← Tutorials

Tutorial Series · Part 8 of 27

From Guessing to Filtering: Prediction Plus Correction

Introduce recursive filtering using prediction and measurement update.

Series Context

Navigation from First Principles

This article is part of an ordered course. Use the previous and next links to stay in sequence.

A navigation filter alternates between two questions:

  1. Prediction: Where should I be now, based on my motion model?
  2. Correction: What do my measurements say, and how much should I trust them?

This pattern is the heart of Kalman filtering. Welch and Bishop’s introduction is a good foundation for the discrete Kalman filter and EKF.1 MathWorks’ insEKF documentation describes the same practical idea in an inertial-navigation context: continuous-time state prediction with discrete-time sensor corrections.2

Why this matters

A moving car receives noisy position measurements every second. Between measurements, it still moves. A useful filter keeps predicting the state, then corrects it when the next measurement arrives.

A simple model

Use a 1D constant-velocity state:

xk=[positionvelocity]\mathbf{x}_k = \begin{bmatrix} position \\ velocity \end{bmatrix}

Prediction:

xkk1=Fxk1k1\mathbf{x}_{k|k-1}=\mathbf{F}\mathbf{x}_{k-1|k-1}

where:

F=[1Δt01]\mathbf{F}=\begin{bmatrix} 1 & \Delta t \\ 0 & 1 \end{bmatrix}

Covariance prediction:

Pkk1=FPk1k1FT+Q\mathbf{P}_{k|k-1}=\mathbf{F}\mathbf{P}_{k-1|k-1}\mathbf{F}^T + \mathbf{Q}

Measurement model:

zk=Hxk+vk,H=[10]z_k = \mathbf{H}\mathbf{x}_k + v_k, \qquad \mathbf{H}=\begin{bmatrix}1 & 0\end{bmatrix}

Update:

K=PHT(HPHT+R)1\mathbf{K}=\mathbf{P}\mathbf{H}^T(\mathbf{H}\mathbf{P}\mathbf{H}^T+R)^{-1} xkk=xkk1+K(zkHxkk1)\mathbf{x}_{k|k}=\mathbf{x}_{k|k-1}+\mathbf{K}(z_k-\mathbf{H}\mathbf{x}_{k|k-1})

Interactive demo

The demo below uses that same 1D model. The car follows a changing acceleration profile, the filter propagates its constant-velocity estimate, and the correction step only happens when a new measurement arrives.

Interactive Demo

Prediction-Correction Demo

A simple constant-velocity Kalman filter predicts between measurements, then corrects when a noisy position update arrives.

Top: true state, estimate, measurements, and one-sigma band Bottom left: position error Bottom right: one-sigma uncertainty

Controls

Show filter equations

x = [position, velocity]^T

x^- = F x predicts forward between measurements.

K = P H^T (H P H^T + R)^-1 sets measurement trust.

Increase measurement noise or the interval to watch corrections arrive later and with less authority.

Readouts

True position0.0 m
Estimate0.0 m
Measurementnone
Position error0.0 m
Sigma0.0 m
Kalman gain0.00

The most useful combinations to try are the failure modes:

  • Raise measurement noise and lower process noise to make the estimate smooth but late.
  • Lower the measurement update rate to watch the covariance band widen between corrections.
  • Raise process noise to make the filter react faster to manoeuvres, at the cost of a noisier estimate.

Try it

Set measurement noise high and process noise low. The filter should become smooth but slow to respond. Then increase process noise. The estimate should follow manoeuvres better, but become noisier.

Limits of this model

This is a linear 1D filter. GNSS/INS fusion is nonlinear, multi-dimensional and uses rotations, biases and coordinate frames. But the mental pattern does not change: predict with a model, correct with measurements, and carry uncertainty forward.

Footnotes

  1. Greg Welch and Gary Bishop, “An Introduction to the Kalman Filter”, TR 95-041. https://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/WELCH/kalman.html - Practical introduction to the discrete Kalman filter and EKF. Accessed 2026-06-11.

  2. MathWorks, “insEKF - Inertial Navigation Using Extended Kalman Filter”. https://www.mathworks.com/help/nav/ref/insekf.html - Continuous-discrete EKF object using inertial sensors for prediction and discrete measurements for correction. Accessed 2026-06-11.