Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 9 of 21 in this unit

Build AI Systems · ORIGINAL LEARN AI LESSON

Fuse noisy measurements.

Predict motion, correct with sensors and inspect the uncertainty assumptions of a linear Kalman filter.

By the end: Explain prediction, innovation, gain and covariance using an inspectable two-state sensor-fusion trace.

Start with the exampleJump to the experimentRead the explanation
Prerequisites and path options

Why learn this? Combine sensors according to their uncertainty and recognize when shared errors defeat the benefit.

01 · TRY

Start with something concrete.

Position readings say where an object is; velocity readings help predict where it will be next. A filter combines these clues while tracking how uncertain it claims to be.

Try the interactive model
02 · PREDICT
Before you experiment

You tell the filter that a sensor is much more accurate without improving its actual readings. What can happen?

You tell the filter that a sensor is much more accurate without improving its actual readings. What can happen?
03 · EXPERIMENT

Change one thing. Watch what follows.

Loading this browser experiment…

04 · UNDERSTAND
READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Explain prediction, innovation, gain and covariance using an inspectable two-state sensor-fusion trace.

The idea in everyday terms

Sensor fusion combines a predicted state with new measurements according to their uncertainty. Position and velocity are related through a motion model, so a velocity reading can affect the predicted position as well as velocity.

What to watch in the experiment

Follow prediction and correction separately. Compare trusting the model more with trusting the measurements more. Inspect how the uncertainty calculation changes when sensors share an error rather than providing independent evidence.

What this does not establish

Combining correlated errors as if they were independent can produce false confidence. This lab uses current simultaneous readings and a declared model; it does not solve every delayed-sensor or real-world fusion problem.

Open the full worked examples, calculations and limitations

This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.

Use motion to connect the clues

Suppose a cart is estimated to be at 1 metre, moving at 0.5 metres per second. After 0.05 seconds, a constant-velocity prediction places it at 1.025 metres. A fresh position reading can correct that prediction. A velocity reading can help correct both velocity and the position prediction it influenced.

The lab implements this idea with two state numbers: position and velocity. Unlike the previous lesson’s independent smoothers, this filter connects them through a motion model. All readings are current and arrive together in this experiment. Handling delayed or out-of-order readings would require additional bookkeeping.

Prediction comes before correction

The filter starts with a declared estimate and uncertainty. It does not initialize from true state. At time zero it uses the first measurements without advancing time. Every later step first advances position using estimated velocity and keeps velocity unchanged in the mean prediction.

The uncertainty calculation additionally allows an unknown acceleration during that interval. A larger assumed acceleration standard deviation allows more uncertainty about the prediction. This is a modelling choice, not a measurement of the actual acceleration.

Innovation means a disagreement

The innovation is the reading minus the prediction for that reading. If predicted position is 1 metre and the sensor reports 1.2 metres, the position innovation is 0.2 metres. It describes disagreement between two available quantities; it is not the true position error.

The Kalman gain determines how much of that disagreement changes the estimate. In a one-number example, prediction variance 4 and sensor variance 1 give gain 4/(4+1) = 0.8. The correction moves 80% of the way toward the reading. If the prediction is more trusted, the correction is smaller.

Variance measures squared spread, so position variance uses square metres. Its square root, the standard deviation, returns to metres. A normalized innovation divides the disagreement by its predicted standard deviation, making the ratio unitless. Large ratios can reveal a mismatch, but they do not tell us whether the sensor, model, timing or bias caused it.

Keep the cross-covariance

The covariance matrix has position variance, velocity variance and a shared cross-covariance. The cross term records how errors in the two estimates are related. An uncertain velocity makes future position uncertain; a position measurement can therefore provide information about velocity too.

This experiment corrects position first, then velocity using the already updated estimate and covariance. Under its independent sensor-error assumption, this is equivalent to a joint two-sensor correction. It would be wrong to reuse the original prediction for both updates and then casually average them, or to ignore correlated measurement errors in a real fusion problem.

The small matrix calculation

Let the state vector be m=[x,v]Tm=[x,v]^T. With interval dd, the constant-velocity transition is F=[1d01]F=\begin{bmatrix}1&d\\0&1\end{bmatrix}. Prediction uses m−=Fmm^-=Fm and P−=FPFT+QP^-=FPF^T+Q. For independent acceleration with variance qq held during the interval, G=[d2/2,d]TG=[d^2/2,d]^T and Q=qGGTQ=qGG^T.

A position measurement uses row H=[1,0]H=[1,0]; velocity uses H=[0,1]H=[0,1]. The innovation is e=z−Hm−e=z-Hm^-, its variance is S=HP−HT+RS=HP^-H^T+R, and the gain is K=P−HT/SK=P^-H^T/S. Correct the mean with m+=m−+Kem^+=m^-+Ke.

The implementation updates covariance in Joseph form: P+=(I−KH)P−(I−KH)T+KRKTP^+=(I-KH)P^-(I-KH)^T+KRK^T. This retains the cross terms and avoids relying on a subtraction of nearly equal covariance entries. Matrices are only 2×2 here; the public trace exposes the values so they can be checked independently.

A band is only as credible as its model

The plot shows two standard deviations on either side of estimated position. Do not call this a guaranteed 95% interval. Such probability interpretations need distributional and model assumptions that this teaching trace does not establish.

The sensors here use fixed seeded uniform noise. Their actual variances are amplitude squared divided by three. The trajectory is an authored sinusoid, not a sample from the independent random-acceleration model. A constant camera bias deliberately violates the assumed zero mean. Covariance can remain unchanged while that bias makes the estimate wrong.

The stationary-model fault disconnects velocity from position and leaves process noise only in velocity. Turning up acceleration uncertainty cannot repair a missing relationship. Compare innovations, true errors and band width rather than choosing the smoothest-looking curve.

Make a fusion audit

Capture the baseline, one changed trust assumption and a model or bias failure. Guided learners should explain each stage in everyday words. Implementation learners should reproduce a correction independently, verify covariance symmetry and nonnegative eigenvalues, and explain the units of the gains. Decision learners should identify the noise, bias and motion assumptions that would need validation before deployment.

Truth-based error scores are simulator diagnostics, never estimator inputs. Controls reuse the same underlying readings; these are development comparisons rather than fresh independent trials. Captures are temporary practice. Human review and learner pilots remain pending.

05 · APPLY
Check your understanding

Why can a position reading change the velocity estimate?

Why can a position reading change the velocity estimate?
06 · CONTINUE

Take this idea with you.

A useful estimate combines a motion model with sensor evidence. Its covariance is a conditional claim that depends on the model, noise and bias assumptions.

My Learning
Explore related topics and the topic map

How this topic connects

Explore this topic on the interactive map

Use these connections to review a foundation or choose where to go next. You can open any topic without completing the others.

What it builds on

You are hereFuse noisy measurements

Predict motion, correct with sensors and inspect the uncertainty assumptions of a linear Kalman filter.

What it enables