Kalman Filter Predict-Update Cycle

Step through prediction, measurement, Kalman gain, and uncertainty updates for a 1D IoT tracker

animation
kalman
filtering
estimation
tracking
sensor-fusion
interactive
Interactive Kalman filter lab with scalar predict-update math, process and measurement noise controls, missing measurements, outlier behavior, uncertainty bands, and mobile-safe reference material.
Scalar 1D model Predict update Uncertainty

Tune a Kalman filter while a noisy IoT tracker moves.

This lab uses a one-dimensional constant-velocity teaching model. Each step shows what the filter believes before the sensor reading, how much the reading is trusted, and how uncertainty changes after the update.

Cycle step Ready Posterior estimate is ready for prediction.
Kalman gain 0.74 Sensor reading is trusted more than the model.
Posterior sigma 2.00 m Uncertainty after the latest correction.
Tracking error 1.2 m Estimate minus true position.

Predict update track

The filter carries a position estimate and variance through every sensor cycle.

Ready
1. Predict state Move the prior estimate forward with the motion model.
2. Predict variance Add process noise because the model can drift.
3. Read sensor Compare the noisy measurement with the prediction.
4. Update estimate Use the gain to blend prediction and measurement.

Model readings

The same state is shown as motion, numbers, and a plain-language diagnosis.

Prediction 26.0 m x_minus from the motion model.
Measurement 24.1 m z from the sensor.
Residual -1.9 m z - x_minus.
Diagnosis Balanced blend The gain reflects relative uncertainty.

Formula trace

Scalar 1D equations using position in metres and variance in square metres.

x_minus = x + v * dt State prediction moves the estimate before seeing the next reading.
P_minus = P + Q Process noise Q increases uncertainty during prediction.
K = P_minus / (P_minus + R) Large R lowers K; large predicted uncertainty raises K.
x = x_minus + K * (z - x_minus) The posterior shifts toward the reading by K times the residual.
P = (1 - K) * P_minus After a valid measurement, posterior variance shrinks.

Learning support

The filter is optimal only under the assumptions used by the model. These notes keep the simplified lab connected to real IoT deployments.

Model reading
State xThe estimated one-dimensional position of the tracked object.
Prediction x_minusThe prior estimate after applying the constant-velocity model.
Measurement zThe noisy sensor reading. It may be biased, missing, or an outlier.
Variance PThe model's uncertainty about the estimate, measured in m^2 here.
Process noise QHow much uncertainty is added because the motion model is imperfect.
Measurement noise RHow noisy the sensor is expected to be. Larger R lowers trust in z.
Guided checks
Raise RThe gain should fall, so the posterior moves less toward the measurement.
Raise QPrediction uncertainty grows faster, so the next valid measurement gets more influence.
Add biasA biased sensor can pull the estimate away from truth even when the math is internally consistent.
Drop readingsThe filter can predict through missing data, but uncertainty should not shrink without a valid update.
Inject outliersHigh gain makes outliers more damaging unless residual gating is added.
Watch sigmaUncertainty expands in prediction and contracts after a trusted measurement.
Technical accuracy notes
Scalar teaching modelThis page uses a 1D scalar position filter. Full position and velocity filters use matrices.
Linear Gaussian caseThe classic Kalman filter is optimal for linear dynamics with unbiased Gaussian noise.
Unitsx, z, and residual use metres. P, Q, and R use square metres because they are variances.
Gain boundsIn this scalar model, K stays between 0 and 1 when P_minus and R are positive.
Noise tuningSmall R does not make a sensor accurate; it only tells the filter to trust the sensor more.
Non-linear motionTurns, constraints, and non-Gaussian faults may require EKF, UKF, particle filters, or gating logic.