State estimation, system propagation, measurement update, gain computation, EKF, and filter tuning.
You have a GPS receiver giving noisy position measurements every second. You have an INS giving smooth but drifting position estimates 50 times per second. How do you combine them optimally?
The Kalman filter (1960, Rudolf Kalman) is the answer. It is a recursive algorithm that maintains an estimate of a system's state and its uncertainty, optimally combining predictions from a model with new measurements.
The state vector x contains everything the filter estimates. In navigation, typical states include position error, velocity error, attitude error, accelerometer biases, gyro biases, and receiver clock errors.
The error covariance matrix P describes the uncertainty in each state estimate and the correlations between them. Diagonal elements are variances (squared uncertainties); off-diagonal elements capture how errors in one state relate to errors in another.
where δx = x̂ − x is the difference between the estimated and true state vectors.
| Symbol | Meaning |
|---|---|
| x | True state vector |
| x̂ | State estimate |
| δx | State error (x̂ − x) |
| P | Error covariance matrix |
| Φ | State transition matrix |
| Q | System noise covariance |
Between measurements, the filter predicts how the state evolves. The linear system model is:
where F is the system matrix (how states evolve), G distributes the system noise ws across states.
For discrete-time processing, the state propagation is:
and the covariance propagation:
The transition matrix Φ propagates states one time step. The system noise Q adds uncertainty to account for unmodeled effects (bumps, gusts, sensor drift).
When a measurement z arrives, the filter corrects its prediction. The measurement model:
where H is the measurement matrix (how measurements relate to states) and wm is measurement noise with covariance R.
The measurement innovation is the surprise — the difference between what you measured and what you predicted:
The state update blends the prediction with the innovation:
And the covariance shrinks:
The Kalman gain K is the heart of the filter. It balances trust between the prediction and the measurement:
Think of it as a trust slider:
| Condition | K approaches | Meaning |
|---|---|---|
| P large, R small | H−1 (trust measurement) | Prediction uncertain, measurement accurate |
| P small, R large | 0 (trust prediction) | Prediction confident, measurement noisy |
Adjust the prediction uncertainty (P) and measurement noise (R) to see how the Kalman gain changes.
The system model defines how states evolve over time. In continuous time: ẋ = Fx + Gws. The system matrix F captures the physics. For a simple position-velocity system:
The transition matrix Φ is the matrix exponential of Fτs (where τs is the time step). For simple systems, Φ ≈ I + Fτs.
The system noise covariance Q models unmodeled forces. For the position-velocity example, if acceleration is white noise with PSD na2:
In many navigation applications, the system model isn't truly linear — the differential of x depends on higher-order terms. The closed-loop implementation feeds back the estimated errors to correct the system itself, zeroing the filter states.
This keeps the filter states small, minimizing linearization errors. In contrast, the open-loop implementation lets states grow, which can degrade linearity assumptions.
Tuning means selecting values for three matrices: initial covariance P0, system noise Q, and measurement noise R. The critical parameter is the ratio P/R.
| P/R too small | P/R optimal | P/R too large |
|---|---|---|
| Gain too low, slow convergence | Good tracking, stable estimates | Gain too high, noisy/unstable estimates |
In practice, the filter model is always an approximation. System noise must overbound reality — "make the round hole big enough for the square peg." Typical 1σ uncertainties are 2–3× the actual error standard deviations to maintain stability.
The standard Kalman filter requires linear models. Real navigation systems are nonlinear — GNSS ranging equations involve square roots and trig functions. The Extended Kalman Filter (EKF) handles this by linearizing about the current state estimate.
The EKF replaces the linear system model Fx with a nonlinear function f(x), and the linear measurement model Hx with h(x). The Jacobians of these functions are used for covariance propagation and gain computation.
The EKF assumes the error is small relative to the nonlinearity. Closed-loop operation helps maintain this assumption by keeping the state estimate close to truth.