Kalman filter: predict, compare, correct
卡尔曼滤波
Derive the Kalman filter as the exact Bayes filter for linear-Gaussian models, run one step by hand, check that it reproduces the batch least-squares answer, and use NEES to see what too-small or too-large noise settings do on a synthetic tracking problem.
kalman-filterPredict, compare, correct
A Kalman filter tracks something that changes over time, such as the position and speed of a car, from noisy measurements. At every step it predicts where the thing should be, compares the prediction with the new measurement, and moves the estimate part of the way toward the measurement. How far it moves depends on how much it trusts the prediction compared with the sensor. Predictor–corrector
For example, a radar reports a car’s position several times a second, but each reading is a little off. The filter also knows that a car tends to keep its speed. Combining the two gives a better position than the radar alone, plus a speed estimate that no sensor measured. In Särkkä’s simulated car-tracking example, the position error (root-mean-square error, RMSE) was 0.77 using the measurements alone and 0.43 with the Kalman filter. Car tracking example
The filter stores two quantities about the state. The mean is its best guess. The covariance is a matrix that says how uncertain that guess is and how errors in different components are linked. Together, they define a Gaussian (bell-shaped) distribution; see the Gaussian distribution and covariance. Mean and covariance
This article builds on state estimation, which derives the general Bayes filter. That filter has a prediction step, which pushes the belief through a motion model, and an update step, which reweights it by the new measurement. In general that filter cannot be computed exactly. When the motion and measurement models are linear and all noise is Gaussian, it can. The Kalman filter is that exact solution, and it needs only a few matrix operations per step. Closed form No approximation
The rest of the article presents the model, lists its five equations, and shows four ways to derive them. It then runs a small synthetic example and explains how to tell whether a filter’s confidence can be believed. Nonlinear models are the subject of extended Kalman filter, and problems with several competing hypotheses need methods such as the particle filter.
The model, the five equations, and why they are exact
This section states the linear-Gaussian model, gives the prediction and update equations with a plain reading of each, and then shows where they come from.
The linear-Gaussian model
Särkkä writes the model as follows. Model, eqs. (4.17)–(4.18)
In words: the new state is a matrix times the old state plus random process noise with covariance . The measurement is a matrix times the state plus random measurement noise with covariance . The starting state is also Gaussian, with mean and covariance . The “process noise” stands for everything the motion model leaves out, such as small accelerations. Barfoot writes where Särkkä writes ; we follow Särkkä.
Prediction
The first step moves the estimate forward in time. Theorem 4.2
In words: the predicted mean is the old mean pushed through the motion model. The predicted covariance is the old uncertainty pushed through the same model, plus the new uncertainty from the process noise. The minus sign marks “before seeing measurement ”. Welch and Bishop call this the time update. Time update
Update
The second step folds in the new measurement. Theorem 4.2
In words: the innovation is the surprise, the measurement minus what the prediction expected. is how large that surprise should typically be. The Kalman gain says how much of the surprise to accept. The word “innovation” means the new information the measurement brings.
In words: the new mean is the prediction plus the gain times the surprise, and the new covariance is the predicted one minus the uncertainty that the measurement removed. Welch and Bishop describe the two extremes of the gain. If the measurement noise goes to zero, the filter trusts the measurement completely. If the predicted covariance goes to zero, the gain goes to zero and the filter ignores the measurement. Gain limits
Why the result is exact
Särkkä’s proof first forms the joint Gaussian distribution of the old and new state, then of the state and the measurement. It then applies the standard rules for marginalising and conditioning Gaussians. No approximation enters, so the predicted distribution, the updated distribution and the distribution of the next measurement are all exactly Gaussian. That is why carrying a mean and a covariance is enough. Proof of Theorem 4.2 Barfoot likewise calls the linear-Gaussian Kalman filter a special case of the Bayes filter that needs no approximations. Footnote 19
Three other routes to the same equations
Least squares. Barfoot starts from the batch problem: estimate the whole trajectory at once by weighted least squares. For this model that is also the maximum a posteriori (MAP) estimate, see MAP estimation. That batch solution is a smoother, because each state uses past and future data. He shows it splits exactly into a forward and a backward recursion, and the forward one is the Kalman filter. Batch to recursive The recursion works because the last estimate and its covariance can stand in for all earlier data. Barfoot notes this uses the Markov property, which holds for linear-Gaussian estimation. Markov property, footnote 17 He also states that his forms are identical to the forward pass of the Rauch–Tung–Striebel (RTS) smoother. Identity with RTS
Choosing the gain. For any gain , the covariance after the update can be written in what is called the Joseph form. Joseph form, eqs. (3.131)–(3.135)
In words: the first term is the leftover prediction uncertainty and the second is the noise let in through the measurement. Choosing to make the total error variance (the trace of this matrix) as small as possible gives exactly the Kalman gain. Gain by trace minimisation Same route The shorter forms and equal the Joseph form only for that optimal gain. With any other gain, only the Joseph form is correct.
Orthogonal projection. Kalman’s own 1960 paper did not use Bayes’ rule. He treated the best estimate as a projection onto the space spanned by the observations. Highlight (5) Särkkä notes that this route needs no explicit Gaussian assumption. The filter is then the best linear unbiased estimator (BLUE), meaning the best among estimators that are linear in the data and right on average. The cost is that extending it to nonlinear models is less direct. Orthogonal projection remark
The information form
Barfoot also gives the update in terms of inverse covariances, called the information form. Information form, eq. (3.117)
In words: precision (inverse covariance) adds up, prediction precision plus measurement precision, and the new mean is a precision-weighted average of the prediction and the measurement. This is the cleanest way to see that the update is a weighted average.
What the covariance promises
Barfoot looks at the estimation error, the estimate minus the truth. If the initial error has mean zero, the error has mean zero at every step: the filter is unbiased. If the initial covariance is the true covariance of the initial error, then equals the true error covariance at every step. A filter whose covariance matches its real errors is called consistent. Unbiased and consistent, eqs. (3.136)–(3.141) These are averages over many imagined repeats of the experiment, not over time; in one run the error need not be small. Ensemble average For a linear system with Gaussian noise, Barfoot calls the filter the best linear unbiased estimate. He also says its covariance sits at the Cramér–Rao lower bound, the smallest covariance an unbiased estimator can have. Optimality remarks
The steady-state filter
The covariance equations never use the measured values . So the whole sequence of covariances and gains can be computed in advance. Item (iii) With constant and , Welch and Bishop note that the covariance and gain settle quickly. Settling gain Using the settled gain at every step gives the steady-state Kalman filter. Item (iii)
For a time-invariant model the settled predicted covariance solves a discrete algebraic Riccati equation (DARE), a fixed-point equation of the prediction–update cycle. Barfoot states when it has a unique positive-semidefinite solution. The conditions are: positive definite; positive semidefinite; stabilisable, where ; and detectable. In our own rough paraphrase, not Barfoot’s wording, stabilisable means the noise reaches every unstable mode. Barfoot glosses detectable as observable except that unobservable modes are stable, so every unstable mode shows up in the measurements. He states these as necessary and sufficient, and the steady-state error dynamics are then stable. He presents this as a proof sketch following Simon (2006). DARE, eqs. (3.142)–(3.145) The test for observability itself is covered in state estimation; detectability is the weaker version that only asks about unstable modes.
Checking consistency with NEES
The normalised estimation error squared (NEES) compares the real error with the error the filter claims. NEES
In words: take the error between the true state and the estimate , and measure its size in units of the filter’s own covariance . Labbe explains that for a correctly working filter NEES follows a chi-square distribution with degrees of freedom. Its average is then about , the state dimension. He credits this theory to Bar-Shalom, whom we did not read. NEES and chi-square NEES needs the true state, so it is a check for simulations. The 95% threshold used below is our own calculation: for the chance that NEES exceeds is , and .
A synthetic tracker, one step by hand, and a consistency test
This section runs a small tracker, checks one step by hand, compares the filter with the batch answer, and tests what wrong noise settings do. The program is an original synthetic simulation, numpy only, with fixed seeds. The truth is simulated from the filter’s own model, so the results say nothing about real sensors. The target moves along a line. Its state is (position, velocity), the time step is 1, and only the position is measured.
In words: position grows by velocity each step, velocity stays constant apart from random changes whose size is set by , and the sensor reads position only. We use , measurement variance , prior mean and , the identity matrix.
import numpy as np
# Synthetic 1-D constant-velocity target: state (position, velocity), dt = 1, position measured.
A = np.array([[1.0, 1.0], [0.0, 1.0]])
C = np.array([[1.0, 0.0]])
q, r = 0.3, 1.0
Q = q * np.array([[1 / 3, 1 / 2], [1 / 2, 1.0]])
R = np.array([[r]])
m0 = np.array([0.0, 1.0])
P0 = np.eye(2)
def simulate(rng, K):
x = rng.multivariate_normal(m0, P0)
xs, ys = [], []
for _ in range(K):
x = A @ x + rng.multivariate_normal(np.zeros(2), Q)
xs.append(x)
ys.append(C @ x + rng.normal(0.0, np.sqrt(r), 1))
return np.array(xs), np.array(ys)
def kalman(ys, Qf, Rf):
# ys has shape (..., K, 1); every leading index is an independent run.
lead = ys.shape[:-2]
m = np.broadcast_to(m0, lead + (2,)).copy()
P = np.broadcast_to(P0, lead + (2, 2)).copy()
ms, Ps, gains = [], [], []
for k in range(ys.shape[-2]):
m = m @ A.T
P = A @ P @ A.T + Qf
S = P[..., 0, 0] + Rf[0, 0]
Kg = P[..., :, 0] / S[..., None]
m = m + Kg * (ys[..., k, 0] - m[..., 0])[..., None]
P = P - S[..., None, None] * Kg[..., :, None] * Kg[..., None, :]
ms.append(m)
Ps.append(P)
gains.append(Kg)
return np.stack(ms, -2), np.stack(Ps, -3), np.stack(gains, -2)
print("1) first step by hand (prior mean (0, 1), P0 = I, q = 0.3, r = 1, measurement y1 = 2.0)")
Pp = A @ P0 @ A.T + Q
S = C @ Pp @ C.T + R
Kg = Pp @ C.T / S[0, 0]
mp = A @ m0
mu = mp + Kg[:, 0] * (2.0 - mp[0])
Pu = Pp - Kg @ S @ Kg.T
print(" predicted P =", np.round(Pp, 4).tolist(), " S =", round(S[0, 0], 4))
print(" gain K =", np.round(Kg[:, 0], 4).tolist())
print(" updated mean =", np.round(mu, 4).tolist(), " updated P =", np.round(Pu, 4).tolist())
print("2) recursive filter vs batch weighted least squares over the whole record")
rng = np.random.default_rng(16)
K = 20
xs, ys = simulate(rng, K)
ms, Ps, gains = kalman(ys, Q, R)
n = 2
N = (K + 1) * n
H = np.zeros((n + K * n + K, N))
z = np.zeros(n + K * n + K)
w = np.zeros(n + K * n + K)
H[0:2, 0:2] = np.eye(2)
z[0:2] = m0
row = 2
Qi = np.linalg.inv(Q)
blocks = [(slice(0, 2), slice(0, 2), np.linalg.inv(P0))]
for k in range(1, K + 1):
H[row:row + 2, (k - 1) * n:k * n] = -A
H[row:row + 2, k * n:(k + 1) * n] = np.eye(2)
blocks.append((slice(row, row + 2), slice(row, row + 2), Qi))
row += 2
H[row, k * n:(k + 1) * n] = C[0]
z[row] = ys[k - 1, 0]
blocks.append((slice(row, row + 1), slice(row, row + 1), np.array([[1 / r]])))
row += 1
Winv = np.zeros((row, row))
for a, b, M in blocks:
Winv[a, b] = M
info = H.T @ Winv @ H
xb = np.linalg.solve(info, H.T @ Winv @ z)
cov_b = np.linalg.inv(info)
print(" final filtered mean =", np.round(ms[-1], 6).tolist())
print(" batch estimate at K =", np.round(xb[-2:], 6).tolist())
print(" mean and covariance agree to 1e-9:", bool(np.abs(ms[-1] - xb[-2:]).max() < 1e-9 and np.abs(Ps[-1] - cov_b[-2:, -2:]).max() < 1e-9))
mid = 10
print(" at k = %d: filter position %.4f, batch (smoothed) position %.4f, truth %.4f" % (mid, ms[mid - 1, 0], xb[mid * n], xs[mid - 1, 0]))
print(" position variance at k = %d: filter %.4f, batch %.4f" % (mid, Ps[mid - 1, 0, 0], cov_b[mid * n, mid * n]))
print(" gain at k = 1, 5, 20:", [np.round(gains[i], 4).tolist() for i in (0, 4, 19)])
print("3) consistency: 500 Monte Carlo runs x 50 steps, NEES averaged over runs and steps")
print(" (state dimension 2: a consistent filter has mean NEES 2; P(NEES > 5.991) = 5%)")
cases = [("correct Q, R", 1.0, 1.0), ("Q x 0.01", 0.01, 1.0), ("Q x 100", 100.0, 1.0),
("R x 0.01", 1.0, 0.01), ("R x 100", 1.0, 100.0)]
rng = np.random.default_rng(2026)
runs = [simulate(rng, 50) for _ in range(500)]
X = np.array([xs for xs, _ in runs])
Y = np.array([ys for _, ys in runs])
for name, fq, fr in cases:
ms, Ps, _ = kalman(Y, fq * Q, fr * R)
e = X - ms
nees = np.einsum("rki,rkij,rkj->rk", e, np.linalg.inv(Ps), e)
rmse = np.sqrt(np.mean(e[..., 0] ** 2))
print(" %-13s mean NEES %8.3f share > 5.991 %6.1f%% position RMSE %.3f" % (name, nees.mean(), 100 * np.mean(nees > 5.991), rmse))
The program prints:
1) first step by hand (prior mean (0, 1), P0 = I, q = 0.3, r = 1, measurement y1 = 2.0)
predicted P = [[2.1, 1.15], [1.15, 1.3]] S = 3.1
gain K = [0.6774, 0.371]
updated mean = [1.6774, 1.371] updated P = [[0.6774, 0.371], [0.371, 0.8734]]
2) recursive filter vs batch weighted least squares over the whole record
final filtered mean = [48.535898, 2.406834]
batch estimate at K = [48.535898, 2.406834]
mean and covariance agree to 1e-9: True
at k = 10: filter position 22.3857, batch (smoothed) position 22.4822, truth 22.5809
position variance at k = 10: filter 0.6489, batch 0.2615
gain at k = 1, 5, 20: [[0.6774, 0.371], [0.6531, 0.3244], [0.6488, 0.3246]]
3) consistency: 500 Monte Carlo runs x 50 steps, NEES averaged over runs and steps
(state dimension 2: a consistent filter has mean NEES 2; P(NEES > 5.991) = 5%)
correct Q, R mean NEES 2.006 share > 5.991 5.3% position RMSE 0.811
Q x 0.01 mean NEES 82.041 share > 5.991 83.9% position RMSE 2.185
Q x 100 mean NEES 1.121 share > 5.991 1.5% position RMSE 0.967
R x 0.01 mean NEES 111.739 share > 5.991 92.0% position RMSE 0.969
R x 100 mean NEES 1.087 share > 5.991 1.2% position RMSE 2.548
Part 1 is the first step by hand, with measurement . Pushing through gives , and adding gives the predicted covariance . The innovation covariance is . The gain is the first column of divided by : . The predicted mean is , so the innovation is and the new mean is . The position variance drops from 2.1 to 0.6774. The velocity estimate also moves, from 1 to 1.371, although velocity was never measured: the off-diagonal covariance links the two.
Part 2 runs the filter on one simulated 20-step record. It then solves the batch weighted least-squares problem for all 21 states at once, built in Barfoot’s stacked form. At the last step both give mean , and mean and covariance agree to . In the middle they differ. At the filter says position 22.3857 with variance 0.6489. The batch solution says 22.4822 with variance 0.2615, and the truth is 22.5809. The batch answer is a smoother: it also uses the ten later measurements. The gain is at , at and at . It settles within a few steps, which is what the steady-state filter exploits.
Part 3 runs 500 simulated records of 50 steps each and gives the same data to five filters. The state has dimension 2, so a consistent filter should have mean NEES near 2, with about 5% of values above 5.991.
| filter’s Q, R | mean NEES (target 2) | share above 5.991 (target 5%) | position RMSE |
|---|---|---|---|
| correct | 2.006 | 5.3% | 0.811 |
| Q × 0.01 | 82.041 | 83.9% | 2.185 |
| Q × 100 | 1.121 | 1.5% | 0.967 |
| R × 0.01 | 111.739 | 92.0% | 0.969 |
| R × 100 | 1.087 | 1.2% | 2.548 |
The correctly specified filter passes: mean NEES 2.006, 5.3% above the threshold, and the lowest error. Making or a hundred times too small makes the filter overconfident: its real errors are far larger than it claims (mean NEES 82.041 and 111.739). With too small it also lags behind the target (RMSE 2.185). Making or a hundred times too large makes it underconfident: mean NEES 1.121 and 1.087, and the error rises to 0.967 and 2.548. A low NEES is not a prize. It means the filter weighs its information wrongly.
Where the guarantees stop
This section lists what the Kalman filter does not promise and how it fails in practice.
“Optimal” only for the assumed model. Exactness needs linear models, Gaussian noise and correct , , and . Without Gaussian noise, the filter is still the best linear unbiased estimator, but not the best estimator overall. BLUE remark Item (i)
Biased noise breaks consistency. Barfoot shows what happens if the noise is not zero-mean, for example with a constant sensor offset. The estimate becomes biased, and the filter underestimates its true error covariance. Section 5.1.1 The filter has no way to notice this by itself.
A shrinking covariance proves nothing. Because ignores the data, it shrinks in the same way whether the data fit the model or not. Labbe describes a “smug” filter whose estimate diverges while its covariance keeps getting smaller, and warns not to trust the covariance alone. Smug filter, cells 67 and 78 The Q × 0.01 row above is such a filter: it claims a small covariance while its errors are large.
Q is hard to choose. The measurement noise can often be measured offline from sensor data. The process noise is harder, because the process is never seen directly. Welch and Bishop note that a crude process model can still work if enough uncertainty is injected through , and that both are often tuned. Tuning Labbe adds that inflating or can hide some model errors at the price of optimality. Inflating noise Part 3 shows the price: a larger error.
Numerics. Rounding can make a computed covariance lose symmetry or positive definiteness, the property that all variances are positive (see positive-definite matrices). Särkkä notes that square-root forms of the covariance recursion are numerically preferable. Square-root remark The Joseph form above is another common safeguard.
Outside its model class. Nonlinear motion or measurement models need an approximation such as the extended Kalman filter. A belief with several separate peaks cannot be held by one Gaussian and needs, for example, a particle filter.
The example is a toy. The data come from the filter’s own model, with chosen values of and . NEES needs ground truth, so on real data one checks the innovations instead. Nothing here measures performance on real sensors.
Exercises
These exercises cover what the covariance means, a hand calculation, a counterexample about NEES, and method choice.
-
The covariance recursion (, , , ) never uses the measured values . What does this let you do, and why does it mean that a small is not evidence that the filter works?
Answer: Because the recursion depends only on , , , and , the gains can be computed ahead of time, and a steady-state gain can be precomputed. For the same reason shrinks identically whether the data agree with the model or not. It is the filter’s claim about its error if the model is right. A wrong model can make the real error large while keeps shrinking, which is Labbe’s “smug” filter. In the example, Q × 0.01 gives mean NEES 82.041. Only a comparison with the truth (NEES, in simulation) or with the innovations (on real data) checks the claim.
-
Scalar random constant: , , , , prior , . Measurements , . Run two filter steps, then check against the batch answer.
Answer: Step 1: , , , , . Step 2: , , , , . Batch: precisions add, , so , and the mean is . The answers are identical: the filter is the batch least-squares answer computed one step at a time.
-
A colleague tunes a filter until its mean NEES is 1.1 for a 2-dimensional state and says: “Below 2, even better than consistent.” Use the example to answer.
Answer: A mean NEES well below means the filter’s covariance is larger than its real errors. It is underconfident, not better. In the example, Q × 100 gives mean NEES 1.121 but position RMSE 0.967, worse than 0.811 for the correct model; R × 100 gives 1.087 and RMSE 2.548. Such a filter puts too little weight on the model or on the data. The target is a mean NEES near with about 5% above the 95% threshold (5.991 for ), together with a low error. NEES also needs the truth, so it is a simulation check.
-
What would you use in each case? (a) A linear time-invariant tracker on a small microcontroller. (b) An offline analysis that wants the best estimate at every past time from the whole log. (c) A linear model whose sensor has an unknown constant offset. (d) A range-and-bearing sensor, whose measurement is a nonlinear function of position.
Answer: (a) A steady-state filter with a constant gain precomputed from the Riccati equation. Its solution exists and is unique under the stabilisability and detectability conditions. In the example the gain is already at . (b) A smoother, either batch least squares or the RTS smoother: at the batch variance is 0.2615 against the filter’s 0.6489, because it also uses later data. (c) A plain filter would be biased and overconfident (Barfoot, Section 5.1.1); the offset must be modelled, for example as an extra state to estimate. We did not read Barfoot’s treatment of biases, so this is only the idea. (d) The Kalman filter no longer applies exactly; use a Gaussian approximation such as the extended Kalman filter, or a sample-based particle filter.
-
Verify Part 1 of the example by hand: , , , .
Answer: and , so . . . , the innovation is , so . For : , , . This matches the output.
History and further reading
This section summarises what Kalman’s 1960 paper contained, as read from a retyped copy, and suggests further reading.
Kalman’s paper “A New Approach to Linear Filtering and Prediction Problems” appeared in the Transactions of the ASME, Journal of Basic Engineering, volume 82 (Series D), pages 35–45, in 1960. A footnote says it was presented at the ASME Instruments and Regulators Conference, 29 March to 2 April 1959, and received on 24 February 1959. Title page footnotes We read a 2002 retyped transcription by John Lukesh, which he describes as a close match to the original, not a scan of the journal.
Kalman was motivated by the limits of the Wiener filter, the earlier frequency-domain method. It was specified by impulse responses, fitted machine computation poorly, and needed a new derivation for every generalisation. He modelled random signals as outputs of linear dynamic systems driven by white noise, described by first-order difference equations with a “state” and a “state transition”. Introduction, items (1)–(4), (6)
His main result, Theorem 3, is a linear dynamic system whose state is the previous estimate and whose input is the newest measurement. It comes with recursions for the gain and the error covariance. The covariance obeys a nonlinear difference equation that plays the role of the Wiener–Hopf equation. The filter is in general time-varying and becomes stationary in the limit for constant model matrices, which recovers the classical Wiener case. Theorem 3 and remarks Two details differ from the modern form above. Kalman’s gain formula, eq. (25), is for the one-step predictor of the next state, not the filtered estimate. His Problem I writes the measurement as a matrix times the state, with no separate additive measurement-noise term; noise enters through the state process. Problem I, eqs. (16)–(17), (25) The form used here is the later textbook version. Model Discrete model The transcriber notes that eq. (32) probably contains a reversed product, so we do not quote it. Transcriber’s note
Kalman also showed that the filtering problem is the dual of the noise-free optimal regulator problem. Transposing the matrices and reversing time maps one set of recursions onto the other (Theorem 4). Theorem 4, Table 1 The control side is the subject of LQR. Kalman wrote that only Theorems 3 and 4 were original. Highlights His remark (m) says the optimal filter is a feedback system and that the signal after its first summer, today called the innovation, is white. Remark (m) The later recognition of the filter as a Bayesian filter, and the continuous-time Kalman–Bucy filter, are covered in state estimation.
For a first hands-on read, Welch and Bishop’s technical report works through a random-constant example: estimating a fixed voltage from 50 noisy readings. With the true measurement variance, the filter’s variance settles to about 0.0002 after 50 steps. Telling the filter a much larger measurement variance makes it slower but smoother, and a much smaller one makes it follow the noise. Random-constant example Labbe’s open book teaches the same ideas through code and plots. Book Särkkä’s Chapter 4 gives the Bayesian derivation compactly, and Barfoot’s Chapter 3 the least-squares view with the steady-state analysis. Chapter 4 Chapter 3 Trackers in object tracking use a constant-velocity Kalman filter like the one above. Related background: linear regression, which is the static version of weighted least squares.
Make a prediction, then check
In a simulation with a 2-dimensional state, a filter's mean NEES is 82 and about 84% of steps exceed the 95% chi-square threshold 5.991. What is the most reasonable reading?
Learning objectives
- Write the Kalman filter's prediction and update equations for the linear-Gaussian model, carry out one step by hand, and explain why it gives exactly the last state of the batch weighted-least-squares (MAP) solution.
- Judge a filter with unbiasedness, consistency and NEES, recognise how too-small or too-large Q and R show up, and state when the steady-state gain and its Riccati equation exist.
Prerequisites & connections
Explore related knowledge →References
- Bayesian Filtering and Smoothing — scoped
Simo Särkkä · 2013 - State Estimation for Robotics — scoped
Timothy D. Barfoot · 2017 - A New Approach to Linear Filtering and Prediction Problems — scoped
R. E. Kalman · 1960 - An Introduction to the Kalman Filter (TR 95-041) — scoped
Greg Welch; Gary Bishop · 2004 - Kalman and Bayesian Filters in Python
Roger R. Labbe · 2024
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). Research was done by a separate research subagent (facts.md) and the prose by a writer subagent; style-only edits suggested by the Gemini app were applied to the intuition section before this check. I compared all eight logged edits for this topic (gemini-edits-016a.json) old against new: six were kept, and two zh wordings were tightened because they shifted a qualifier. I checked D012 readability on the intuition section and section openings (opening summary, sentence length, citations at paragraph ends, a plain reading after every display equation) and found them already compliant, so no readability rewrite was needed beyond the fixes listed. I ran example.py with the pinned interpreter (numpy 1.26.4). Its output is byte-identical to example.stdout.txt, both python blocks are byte-identical to example.py, and every number quoted in the prose, table, exercises and quiz matches the output. I re-derived the first step by hand, the two-step scalar exercise against the batch answer (-75/201, 1/201), the Joseph-form remark and the 5.991 threshold (e^{-5.991/2} = 0.0500). I fetched the sources myself. Kalman 1960: the Internet Archive copy at the cited URL (served now as an 8-page re-saved PDF, so the writer's PDF-page mapping does not hold for it). There I re-read the abstract, introduction items (1)-(6), 'Only Theorems 3 and 4 are original', the footnotes (presented 29 Mar-2 Apr 1959, received 24 Feb 1959, 59-IRD-11), Problem I eqs. (16)-(17) (y = Mx, no additive measurement noise), eqs. (19)-(25) (eq. (25) is the gain for x*(t+1|t)), remarks (h)-(m), Theorem 4 with Table 1, and Lukesh's note on eq. (32). Barfoot (barfoot_ser17.pdf): §3.3.4-§3.3.7 pp. 70-73, including items (i)-(v), the ensemble-average paragraph and the DARE conditions. Särkkä (pdftotext): pp. 58 and 61-62 (square-root remark, orthogonal-projection and BLUE remark), plus the RMSE 0.77/0.43 sentence. Welch & Bishop TR 95-041: gain limits p. 3, tuning p. 6 ('injects' uncertainty), random-constant 0.0002 V^2. Labbe at commit 04b2bea8, notebook 08: markdown cells 67, 78, 112-115 and 188. Not re-read: Barfoot §3.3.1-§3.3.2 and §5.1.1 in detail, Särkkä Theorem 4.2 proof line by line, and Bar-Shalom (never read, which the article says). The data.json IDs and the absence of cycles were checked against src/data/catalogue.txt and relationships.ts.
- Example rerun with pinned numpy 1.26.4 matches example.stdout.txt byte for byte; both code blocks equal example.py; every number in prose, table, exercises and quiz matches the output.
- Re-derived: the first step by hand, the scalar two-step exercise against the batch answer (-75/201, 1/201), that the short covariance forms equal the Joseph form only for the optimal gain, and the 5.991 threshold (e^{-5.991/2} = 0.05, labelled as our own calculation).
- Kalman 1960 (transcription) checked: Problem I is y = Mx with no additive measurement noise; eq. (25) is the gain of the one-step predictor x*(t+1|t); eq. (32) is not quoted and the transcriber's note is as described; remark (m), Theorem 4 and Table 1, 'Only Theorems 3 and 4 are original', and the conference and receipt dates are correct.
- Barfoot's DARE conditions on pp. 72-73 (R > 0, Q >= 0, (A,V) stabilisable, (A,C) detectable; necessary and sufficient; proof omitted, following Simon 2006) match the article. The plain gloss of stabilisable is now marked as our paraphrase, and detectable is glossed as Barfoot defines it.
- Labbe ch. 08 cells 67 and 78 (smug filter, do not trust the covariance), 112 (NEES, chi-square with n degrees of freedom, credited to Bar-Shalom) and 188 (inflating noise masks some error) support the corresponding statements.
- zh and en compared section by section: definitions, numbers, exercises, answers and hedges agree; display equations and source sets are identical; no bare < or braces in MDX prose; unwritten topics (extended-kalman-filter, particle-filter and others) stay inline code.
Source locations checked:
- A New Approach to Linear Filtering and Prediction Problems — scoped · pdftotext of the Lukesh 2002 transcription (12 PDF pages; PDF p. n = journal p. 34+n). Journal p. 35: title, abstract (state-transition method; nonlinear difference equation for error covariance; dual of noise-free regulator), introduction items (1)–(4), highlights (5)–(6), footnotes (presented 29 Mar–2 Apr 1959, received 24 Feb 1959, Paper 59-IRD-11, 82 (Series D): 35–45). p. 36: highlights (7)–(9), 'Only Theorems 3 and 4 are original', notation. p. 37 skimmed (Theorem 1, orthogonal projections, linear vs nonlinear estimation remark). p. 40: summary of assumptions, Problem I eqs. (16)–(17) (no additive measurement-noise term), derivation eqs. (18)–(22), Fig. 3. p. 41: eqs. (23)–(25), Theorem 3 eqs. (21), (23), (26)–(31), remarks (h) eq. (32) and (i). p. 42: remarks (j)–(m), Problem II eqs. (33)–(37), Theorem 4, Table 1, remarks (n)–(o). PDF p. 12: transcriber's note (eq. (32) possibly has a reversed product). NOT read: journal pp. 38–39 in detail, pp. 43–45 (examples, appendix, references).
- Bayesian Filtering and Smoothing — scoped · pdftotext, printed pages. KF topic: p. 56 (end of proof of Thm 4.1; §4.3 opening, eqs. 4.17–4.18); p. 57 (Theorem 4.2, eqs. 4.19–4.21; proof step 1, eqs. 4.22–4.23); p. 58 (eqs. 4.24–4.29; square-root remark citing Grewal and Andrews; Example 4.2 start); p. 59 (Fig. 4.4, eq. 4.31, Example 4.3 start); p. 60 (A, Q, H, R matrices); p. 61 (update step, Fig. 4.5 caption RMSE 0.77 vs 0.43, parameters σ = 1/2, q = 1, Δt = 1/10; orthogonal-projection remark); p. 62 (BLUE remark; exercises 4.1–4.6); p. 63. NOT read for this topic: Ch. 2–3, Ch. 6–12, appendices (Lemma A.1–A.2 not opened).
- State Estimation for Robotics — scoped · pdftotext of barfoot_ser17.pdf (2022 compile), printed pages. p. 58 (end of RTS smoother); p. 59 (Fig. 3.3, §3.3.1 opening, eq. 3.84); p. 63 (eqs. 3.99–3.103, §3.3.2 opening, footnote 16); p. 64 (eqs. 3.104–3.109, footnote 17 Markov property, Fig. 3.4); pp. 65–66 (eqs. 3.110–3.117 information form); p. 67 (Fig. 3.5, eqs. 3.118–3.120 canonical form, innovation); p. 68 (identity with RTS forward pass; §3.3.3 eqs. 3.121–3.125; footnote 19); p. 70 (eqs. 3.131–3.135, footnote 20 Joseph form; §3.3.5 items (i)–(v)); pp. 71–72 (§3.3.6 eqs. 3.136–3.141, ensemble vs time average); pp. 72–73 (§3.3.7 DARE eq. 3.142, conditions, eqs. 3.143–3.145); pp. 152–153 (§5.1.1 eqs. 5.1–5.10). NOT read: pp. 60–62, 69, §3.1–3.2 (other than p. 58), §5.1.2 onward, Ch. 6 onward.
- An Introduction to the Kalman Filter (TR 95-041) — scoped · pdftotext of 95-041.pdf, all 16 pages. KF topic uses p. 1 (abstract: recursive, minimises mean squared error), p. 2 (eqs. 1.1–1.4), p. 3 (eqs. 1.5–1.8, gain limits R → 0 and P⁻ → 0), p. 4 (probabilistic origins; predictor–corrector), p. 5 (Tables 1-1/1-2 eqs. 1.9–1.13; recursion vs Wiener filter), p. 6 (tuning Q and R; Fig. 1-2; constant Q, R → P and K stabilise), p. 7 (time-varying R and Q), pp. 11–15 (random-constant example: Q = 1e-5, P₀ = 1, R = 0.01/1/0.0001, P settles to about 0.0002 V² after 50 iterations — read off a figure caption).
- Kalman and Bayesian Filters in Python · Raw notebooks at commit 04b2bea802321086effbd99402fc13c893d11110, markdown cells only. 08-Designing-Kalman-Filters.ipynb: cells 53–67 (evaluating filter order with 3σ residual bands; cell 67 'smug' filter: P shrinks while the estimate diverges), cell 78 ('Do not trust the filter's covariance matrix'), cell 112 (evaluating performance: real sensors and models inexact; NEES definition; chi-square with n degrees of freedom, expected value n; credits Bar-Shalom), cells 113–115, cells 178 and 188 (inflating noise to mask nonlinearity). README 'License' section: text CC BY 4.0, code MIT. NOT read: other chapters, code cells, filterpy source, Bar-Shalom.
Related topics