control//state estimation//Kalman filter//initial covariance
Where the uncertainty of a filter starts, and why the choice matters less than it seems. The covariance \(P\) is never measured, it is propagated (estimate covariance); it only needs someone to hand it the first value. The **initial covariance** \(P_0\) is that bootstrap, the uncertainty the filter starts with, chosen once together with the first estimate \(\hat x_0\).
Where the uncertainty of a filter starts, and why the choice matters less than it seems. The covariance PPP is never measured, it is propagated (estimate covariance); it only needs someone to hand it the first value. The initial covariance P0P_0P0 is that bootstrap, the uncertainty the filter starts with, chosen once together with the first estimate x^0\hat x_0x^0.
If you have no idea, choose a large P0P_0P0 and move on. The gain of the first step is then close to one, the filter listens almost entirely to the first measurement, and in a few steps it has forgotten the bad guess. If there is evidence (the last known position, a datasheet), P0P_0P0 is set from it. In practice:
A large P0P_0P0, a diffuse initialization, is the safe default; econometricians push it to the limit P0→∞P_0\to\inftyP0→∞ with an exact version of the filter.
The first readings can set it: x^0=z0\hat x_0=z_0x^0=z0 and P0=RP_0=RP0=R for a scalar; for position and velocity two readings are needed, p0=z1p_0=z_1p0=z1 and v0=(z1−z0)/Δtv_0=(z_1-z_0)/\Delta tv0=(z1−z0)/Δt, with the covariance that follows from RRR (two-point initialization). Or a batch least-squares fit of the first NNN readings, recursive from then on.
A small P0P_0P0 with a bad x^0\hat x_0x^0 is the one thing not to do. It is arrogance: the filter believes it already knows, ignores the sensor and takes a very long time to converge, if it converges at all.
It matters less than it seems. In an observable system with Q>0Q>0Q>0, PPP converges to a steady value that does not depend on P0P_0P0; P0P_0P0 only decides the transient. For the scalar filter with F=1F=1F=1 the fixed point solves a small Riccati equation,
P∞−=Q+Q2+4QR2,K∞=P∞−P∞−+R.P^-_\infty=\frac{Q+\sqrt{Q^2+4QR}}{2},\qquad K_\infty=\frac{P^-_\infty}{P^-_\infty+R}.P∞−=2Q+Q2+4QR,K∞=P∞−+RP∞−.
With Q=0.01Q=0.01Q=0.01 and R=3.98R=3.98R=3.98, P∞−≈0.205P^-\infty\approx0.205P∞−≈0.205 and K∞≈0.049K\infty\approx0.049K∞≈0.049, whatever P0P_0P0 was. Once everything settles, the gain stops changing: the steady-state Kalman filter is an exponential smoother with the optimal constant, which is where it meets the EWMA.