Kalman filter: infer hidden states
A sensor cannot always reveal every state directly.
First, picture it
A camera can tell where a cart is now; comparing positions over time hints at its velocity, but noisy measurements make direct differentiation jittery. An observer combines a model prediction with new measurements.
What the model says
The discrete Kalman filter predicts the next state with A and B and updates it using y=Cx+v. Process covariance Q describes how uncertain the model prediction is; measurement covariance R describes expected sensor noise. Those are assumptions to test, not universal tuning knobs. This lab senses cart position and pole angle and estimates both velocities. For this isolated lesson, feedback still uses the simulated true state.
x̂ₖ⁻=Ax̂ₖ₋₁+Buₖ₋₁; x̂ₖ=x̂ₖ⁻+Kₖ(yₖ−Cx̂ₖ⁻)The innovation y−Cx̂ is the part of the measurement the prediction missed.
Make it concrete
Hold injected sensor noise fixed; increase assumed R. The estimate often looks smoother, but may react later to a real kick.
Open the Kalman experimentA Kalman estimate is not ground truth. Wrong models, biased sensors and non-Gaussian disturbances can defeat the ideal assumptions.
Check your understanding+
What changes when assumed sensor variance R increases?
The filter trusts a measurement less relative to its model prediction, subject to the full covariance dynamics.