Your Equation

Library / Tracking and estimation / TRK-01

Tracking and estimation

Scalar Kalman filter measurement update

One measurement update for a single state.

Ref
TRK-01
Rev
v1
Field
Tracking and estimation
Result
x̂+ [m]

The prediction x̂⁻ has variance P⁻ and the measurement z has variance R. The Kalman gain K = P⁻/(P⁻ + R) says how far to move towards the measurement: a certain measurement (small R) gives a gain near 1, an uncertain one a gain near 0. The updated variance P⁺ = (1 − K)P⁻ is always smaller than both inputs. For the optimal gain this is identical to the Joseph form used in numerical code. The updated estimate is the output.

One measurement update for a single state. The estimate moves towards the measurement by a fraction K, set by how uncertain the prediction is compared with the sensor.

Calculator

Solve for
m
m
0100
m²
0.525
m
0100
m²
0.125
  • Kalman gain, K = P−/(P− + R)0.8
  • Updated variance, P+ = (1 − K)P−0.8 m²
  • Innovation, ν = z − x̂−2 m
  • Innovation variance, S = P− + R5 m²

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Updated estimate (m) current value 11.6 m
zMeasurementKey driver
282
x̂-Predicted state
9.629.6
RMeasurement variance
10.312
P-Prediction variance
10.711.9
  • The prediction is 4 times more uncertain than the sensor, so the filter moves 80 % of the way to the measurement, from 10 m to 11.6 m. The uncertainty falls from 4 m² to 0.8 m².
  • If the sensor were as uncertain as the prediction (R = 4 m²) the gain would be 0.5 and the estimate 11 m, with a variance of 2 m². Combining two equally good sources halves the variance.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (m)Local stepChange in result
z Measurement0 to 100 m28280+10%+8.28 %
x̂- Predicted state0 to 100 m9.629.620+10%+1.72 %
R Measurement variance0.1 to 25 m²10.2811.951.675+10%−0.27 %
P- Prediction variance0.5 to 25 m²10.6711.921.256+10%+0.255 %

Sweep of Measurement variance

Measurement variance (m²)Updated estimate (m)
0.111.95
3.21211.11
6.32510.77
9.43710.6
12.5510.48
15.6610.41
18.7710.35
21.8910.31
2510.28

Sweep one variable

Updated estimate (m)Hover, touch, or use the arrow keys on the chart
10.51111.512 510152025 Measurement variance (m²) now 11.6

Variables and how each one contributes

x̂+

Updated estimate

Result · m

What the equation gives you. Everything else feeds it.

x̂-

Predicted state

m · typical 0 to 100

The predicted state before seeing the measurement, in m. Moves the updated estimate by the fraction (1 − K) of its change. Raising it by 10 % (to 11) moves the result by +1.72 %, from 11.6 to 11.8 m.

P-

Prediction variance

m² · typical 0.5 to 25

The variance of the prediction, in m². It is the square of the standard deviation. A more uncertain prediction means the filter trusts the measurement more, so the estimate moves closer to it. Raising it by 10 % (to 4.4) moves the result by +0.255 %, from 11.6 to 11.63 m.

z

Measurement

m · typical 0 to 100

The measurement, in m. Moves the updated estimate by a fraction K of its change. Raising it by 10 % (to 13.2) moves the result by +8.28 %, from 11.6 to 12.56 m.

R

Measurement variance

m² · typical 0.1 to 25

The variance of the measurement noise, in m². A noisier sensor reduces the gain, so the estimate stays closer to the prediction. Raising it by 10 % (to 1.1) moves the result by −0.27 %, from 11.6 to 11.57 m.

Worked example with the values above

  1. Gain: K = P⁻/(P⁻ + R) = 4 / (4 + 1) = 0.8.
  2. Innovation: ν = z − x̂⁻ = 12 − 10 = 2 m, so x̂⁺ = 10 + 0.8 × 2.
  3. x̂⁺ = 11.6 m, with variance P⁺ = (1 − 0.8) × 4 = 0.8 m².

Assumptions and limits

  • A scalar linear Gaussian model, with zero-mean white noise whose variances P⁻ and R are known correctly.
  • The measurement is of the state itself (H = 1), and the prediction and measurement errors are independent.

Common mistakes

  • Using standard deviations where variances are expected. P and R are variances, in m².
  • Trusting the updated variance without checking. If R or the process noise are set wrongly, P⁺ can be far too optimistic. Examine the innovations.

Statistics and uncertainty

The update is an inverse-variance weighted average, and the variances add as reciprocals: 1/P⁺ = 1/P⁻ + 1/R = 0.25 + 1 = 1.25, so P⁺ = 0.8 m². The variance is smaller than either input, so the uncertainty always falls with a measurement. It is only as reliable as P⁻ and R: if the noise levels are set too low, the filter becomes overconfident.

Where it is used

  • Understanding how a Kalman filter weights a prediction against a measurement.
  • Checking the first step of a tracker or a navigation filter by hand.

Maths you need

  • Variance: the square of the standard deviation
  • Weighted average: weights proportional to 1 / variance

Related formulas

Practise this formula