Try It: Kalman Gain Calculator

Try It: Kalman Gain Calculator

animation
sensors
Try Leave Preset scenario on Custom (use sliders), with P (prediction uncertainty) at 10 and R (measurement noise) at 5. Raise R to reduce the measurement’s share.
Observe The default gain is 0.667, with 33% prediction and 67% measurement displayed. New P falls from 10.0 to 3.33 for this update.
Explain P (prediction uncertainty) divided by the sum of P and R (measurement noise) gives the gain. New uncertainty is P multiplied by one minus that gain.

Technical boundaries. The scalar update assumes P and R are variance inputs with compatible units. Presets override slider values, including R = 1000 beyond the custom slider maximum; no measured state or repeated prediction cycle is calculated.

Try It: Kalman Gain Calculator

Move the controls to see how prediction variance P and sensor variance R set the gain K. A larger gain gives the new reading more weight.

Suppose two designs have the errors below. The ratio shows how much smaller one error is. These values are assumptions, not test results.

Tip

For an illustrative indoor case, suppose the error falls from 6.5 m to 2.0 m. The ratio is:

Improvement factor=σsingleσfused=6.5 m2.0 m=3.25×\text{Improvement factor} = \frac{\sigma_{single}}{\sigma_{fused}} = \frac{6.5 \text{ m}}{2.0 \text{ m}} = 3.25\times

Here PP is prediction error variance and RR is measurement error variance. Both use squared metres in this position example. The scalar gain is:

K=PP+RK = \frac{P}{P + R}

If IMU prediction uncertainty is P=1P = 1 and GPS measurement noise is R=9R = 9 (a one-standard-deviation error of 3 m, variance = 323^2), then K=11+9=0.1K = \frac{1}{1+9} = 0.1 — the update shifts only 10% toward GPS, trusting the IMU prediction 90%. When GPS is missing, skip its update and propagate the state and uncertainty until a valid fix returns. Conversely, if IMU has drifted significantly (P=100P = 100) and GPS is strong (R=9R = 9), K=100109=0.92K = \frac{100}{109} = 0.92 — trust GPS 92%. This weighting can help when the model and noise estimates remain valid; faults and biased readings can still cause failure.

Back to the chapter