Dynamic State Estimation When Sensors Lie

I once spent three weeks debugging a satellite attitude estimation system. The gyros and magnetometers were good hardware. The math was correct. The output oscillated. Turns out the sensors were sampling at 200Hz and 50Hz respectively, and feeding them into the estimator with their raw timestamps produced artifacts that looked like real dynamics. Resampling everything to a uniform 50ms grid fixed it. This kind of problem shows up constantly when you work on Optimal Estimation Of Dynamic Systems. The core question is deceptively simple. You have a system whose internal state you cannot measure directly. Sensors give you readings. Those readings are corrupted by noise, arrive irregularly, and some states may have no sensor at all. How do you extract a reliable estimate of what is actually happening?

The Linear Gaussian Framework

The standard starting point assumes a discrete-time linear system with Gaussian noise: State equation: x_t = F x_{t-1} + w_{t-1}, where w ~ N(0, Q) Observation equation: z_t = H x_t + v_t, where v ~ N(0, R)

F is the state transition matrix. H maps the state space into the measurement space. Q and R are covariance matrices for process noise and observation noise respectively. Under these assumptions, the Kalman filter produces the minimum variance unbiased estimate of the state. That is a formal guarantee, not a heuristic. If the model is right, nothing better exists among linear estimators. The filter operates in two alternating steps. The prediction step propagates the state estimate forward using F and inflates the uncertainty using Q. The update step incorporates the new measurement z_t, computing a gain that determines how much to correct based on the relative reliability of the prediction versus the observation.

Get the Full Details

Optimal Estimation of Dynamic Systems Second Edition John L. Crassidis full | PDF
Optimal Estimation of Dynamic Systems Second Edition John L. Crassidis full | PDF

What the Covariance Actually Tracks

The matrix P_t in the Kalman filter represents the error covariance of the state estimate. It quantifies how uncertain we are about each state variable and how those uncertainties correlate. Many engineers treat P as an internal bookkeeping detail. It is not. P_t drives the Kalman gain K_t = P_t H^T (H P_t H^T + R)^{-1}, which decides how aggressively the filter trusts new measurements versus its own prediction. When R is small relative to H P_t H^T, the gain approaches the identity and the filter largely adopts the measurement. When P_t is small relative to R, the gain shrinks and the filter relies more on its model prediction. The balance is automatic and optimal under the model assumptions.

Process Noise Q Is Not What You Think

The most common mistake I see is setting Q too small. A tiny Q tells the filter that the model is nearly perfect and that state changes only occur through the deterministic F matrix. The filter becomes overconfident. It resists correcting its predictions even when measurements clearly contradict them. The estimate drifts silently because the filter does not believe the measurements are reliable enough to override its model. The counterintuitive fix is often to increase Q. A larger Q makes the filter acknowledge that the model is incomplete. It learns to trust observations more readily. In a quadcopter attitude estimator I tuned last year, multiplying Q by ten made the filter respond smoothly to magnetic disturbances instead of fighting them. The tradeoff is that larger Q also lets more noise through. Finding the right balance requires understanding what Q represents: it encodes your belief about unmodeled dynamics, not sensor noise.

Nonlinear Systems Require Approximation

Most real systems are nonlinear. The equations become x_t = f(x_{t-1}) + w_t and z_t = h(x_t) + v_t. The Kalman filter no longer applies directly. The Extended Kalman Filter linearizes f and h around the current estimate using Jacobians. This works well when the nonlinearities are mild. It fails when the linearization error dominates. The Unscented Kalman Filter avoids Jacobians entirely. It propagates a set of deterministically chosen sigma points through the nonlinear functions and reconstructs the mean and covariance from the transformed points. UKF typically achieves better accuracy than EKF for the same computational cost when nonlinearities are significant. The downside is roughly three times more operations per step because you need 2n+1 sigma points for an n-dimensional state. For highly nonlinear or non-Gaussian problems, particle filters exist. They represent the posterior distribution with a set of weighted samples. They handle arbitrary distributions and can track multiple modes. The cost scales poorly with state dimension. A 50-dimensional particle filter requires thousands of particles for reasonable accuracy, which is often impractical on embedded hardware.

خرید و قیمت دانلود کتاب Optimal estimation of dynamic systems | ترب
خرید و قیمت دانلود کتاب Optimal estimation of dynamic systems | ترب

Computational and Numerical Considerations

The standard Kalman update requires inverting the innovation covariance S = H P H^T + R. For high-dimensional systems this inversion is expensive. The computational complexity is O(n^3) for the matrix operations, where n is the state dimension. Memory usage is O(n^2) to store P. Numerical stability matters. P must remain symmetric positive definite throughout the recursion. Round-off errors can violate this property in long-running implementations. The Square Root Kalman Filter maintains the Cholesky factor of P instead of P directly, which improves numerical behavior significantly. Many production systems use this variant without advertising it. I worked on a navigation filter with over 100 state variables. The full covariance update took approximately 40ms on a 400MHz DSP, which was unacceptable for a 100Hz update rate. Switching to a sparse approximation reduced the per-step time to about 3ms with negligible accuracy loss. The sparsity came from the fact that most states only interact locally through the physical model.

Missing and Irregular Observations

Real sensors drop packets. GPS signals disappear in tunnels. Radar occlusions occur in bad weather. The Kalman filter handles missing observations naturally: when z_t is unavailable, simply skip the update step and rely on the prediction. The covariance P_t will grow during the missing interval, reflecting increased uncertainty. Once the sensor returns, the filter resumes correction with the updated gain. The complication arises when missingness is correlated with the state. If a GPS receiver loses signal specifically when the vehicle enters a dense urban canyon, the missing data is informative. The filter should account for this correlation. Simply skipping updates treats the missingness as random, which can produce overconfident estimates during prolonged outages.

When the Model Is Wrong

All of the above assumes the model matrices F, H, Q, and R are correctly specified. In practice they are approximations. Parameter mismatch is inevitable. The filter will still produce estimates, but they may be suboptimal or even inconsistent if the mismatch is severe. A filter that believes its model is more accurate than it actually is will systematically understate its uncertainty, leading to confidence that is unwarranted. Innovation testing helps detect model mismatch. The innovation sequence nu = z_t - H x_hat_{t|t-1} should be white noise with covariance S under correct model specification. Computing the normalized squared innovation nu^T S^{-1} nu and checking whether it follows a chi-squared distribution provides a statistical test. Persistent violations indicate that Q, R, or the model structure needs adjustment.

Optimal Estimation of Dynamic Systems, 2nd Edition [Book]
Optimal Estimation of Dynamic Systems, 2nd Edition [Book]

Alternative Approaches

When the linear Gaussian assumptions break down fundamentally, other frameworks become necessary. Hidden Markov Models handle discrete state spaces. Gaussian mixture models represent multimodal distributions. Rao-Blackwellized particle filters combine analytical integration for linear substructures with particle sampling for nonlinear parts. These approaches are more flexible but substantially more complex to implement and tune. For many engineering applications, theKalman filter family remains the default choice precisely because it is simple, well-understood, and adequate when the model is reasonable. The cost of getting it wrong is usually underestimated. The cost of building a more sophisticated estimator from scratch is often overestimated. Start with the standard Kalman filter. Add complexity only when diagnostics demand it. Optimal Estimation Of Dynamic Systems is not a single algorithm but a framework for reasoning about uncertainty. The Kalman filter is its most important member. Understanding when it applies, when it fails, and how to diagnose its failures is more valuable than memorizing the update equations. The equations are trivial to look up. The judgment about what the model represents and whether the assumptions hold is what separates a working system from one that produces confident garbage.