Formula sheet

Kalman Filtering and State Estimation Formula Sheet

Formula sheet for Kalman filtering and engineering state estimation, covering state-space models, prediction, covariance, innovation, Kalman gain, sensor fusion, gating, observability, EKF linearization, and validation metrics.

This formula sheet collects the core equations used in Kalman filtering and engineering state estimation. Use it for digital twins, navigation, sensor fusion, control, process monitoring, structural monitoring, battery state estimation, robotics, and condition monitoring.

The formulas are useful only when the model, measurement boundary, timing, units, noise assumptions, observability, and validation evidence are stated. A filter can produce smooth estimates even when the underlying engineering model is wrong.

State-Space Model

Discrete linear state model:

x_k=A_{k-1}x_{k-1}+B_{k-1}u_{k-1}+w_{k-1}

Measurement model:

z_k=H_kx_k+v_k

where:

  • x_k is the state vector;
  • u_k is the input or command vector;
  • z_k is the measurement vector;
  • A_k is the state-transition matrix;
  • B_k is the input matrix;
  • H_k is the measurement matrix;
  • w_k is process noise;
  • v_k is measurement noise.

Common covariance assumptions:

w_k\sim \mathcal{N}(0,Q_k)
v_k\sim \mathcal{N}(0,R_k)

where Q_k is process-noise covariance and R_k is measurement-noise covariance.

Prediction Step

Predicted state:

\hat{x}_{k|k-1}=A_{k-1}\hat{x}_{k-1|k-1}+B_{k-1}u_{k-1}

Predicted covariance:

P_{k|k-1}=A_{k-1}P_{k-1|k-1}A_{k-1}^T+Q_{k-1}

The prediction step moves the estimate forward before the next measurement is used. Q should represent unmodelled dynamics, disturbances, input uncertainty, model simplification, and process variability. Setting Q too small can make the estimator overconfident.

Innovation

Predicted measurement:

\hat{z}_{k|k-1}=H_k\hat{x}_{k|k-1}

Innovation:

\nu_k=z_k-\hat{z}_{k|k-1}

Innovation covariance:

S_k=H_kP_{k|k-1}H_k^T+R_k

The innovation is the measurement surprise before the update. Persistent biased innovations usually indicate sensor bias, missing inputs, model drift, incorrect noise assumptions, wrong timing, or operation outside the model validity domain.

Kalman Gain

Kalman gain:

K_k=P_{k|k-1}H_k^TS_k^{-1}

The gain balances model prediction against measurement evidence. Larger predicted uncertainty or lower measurement uncertainty increases measurement influence. Lower predicted uncertainty or higher measurement uncertainty makes the filter trust the model more.

Update Step

Updated state:

\hat{x}_{k|k}=\hat{x}_{k|k-1}+K_k\nu_k

Updated covariance:

P_{k|k}=(I-K_kH_k)P_{k|k-1}

Joseph stabilized covariance form:

P_{k|k}=(I-K_kH_k)P_{k|k-1}(I-K_kH_k)^T+K_kR_kK_k^T

The Joseph form is often preferred in numerical implementations because it better preserves covariance symmetry and positive semidefiniteness under roundoff and modelling errors.

Scalar Direct-Measurement Case

For a scalar state measured directly:

\displaystyle K=\frac{P^-}{P^-+R}

Updated estimate:

\hat{x}^+=\hat{x}^-+K(z-\hat{x}^-)

Updated variance:

P^+=(1-K)P^-

where P^- is prediction variance and R is measurement variance.

If P^- \ll R, the filter trusts the prediction. If P^- \gg R, it follows the measurement more strongly.

Inverse-Variance Sensor Fusion

For independent unbiased scalar measurements x_i with variances \sigma_i^2, inverse-variance weights are:

\displaystyle w_i=\frac{1}{\sigma_i^2}

Weighted estimate:

\displaystyle \hat{x}=\frac{\sum_i w_ix_i}{\sum_i w_i}

Estimate variance:

\displaystyle \sigma_{\hat{x}}^2=\frac{1}{\sum_i w_i}

This formula assumes independent errors. If sensors share calibration bias, common timing error, common environment, or the same processing pipeline, the apparent uncertainty can be too optimistic.

Normalized Innovation and Gating

Normalized innovation for a scalar measurement:

\displaystyle z_{\nu,k}=\frac{\nu_k}{\sqrt{S_k}}

Normalized innovation squared:

NIS_k=\nu_k^TS_k^{-1}\nu_k

For a measurement vector of dimension m, NIS_k is often compared with a chi-square threshold:

NIS_k\leq \chi^2_{m,\alpha}

where \alpha is the selected confidence level.

Gating decisions should be tied to engineering consequences. A rejected measurement may indicate a faulty sensor, but it may also indicate a real event that the model failed to predict.

Residual After Update

Post-fit residual:

r_k=z_k-H_k\hat{x}_{k|k}

Pre-fit innovations and post-fit residuals answer different questions. Innovations test whether new measurements agree with prediction. Post-fit residuals test how well the updated estimate explains the measurements. Both should be reviewed during commissioning and drift detection.

Observability

For a time-invariant linear system, the observability matrix is:

\displaystyle H \\ HA \\ HA^2 \\ \vdots \\ HA^{n-1} \end{bmatrix}$$ The system is observable if: $$rank(\mathcal{O})=n$$ where $n$ is the number of states. Practical observability is more than matrix rank. Poor sensor placement, weak excitation, high noise, slow sampling, missing operating modes, and correlated inputs can make an estimate unreliable even when a symbolic model appears observable. ## Continuous to Discrete Approximation Continuous linear model: $$\dot{x}=Fx+Gu+w$$ First-order discrete approximation for small $\Delta t$: $$A\approx I+F\Delta t$$ $$B\approx G\Delta t$$ More accurate discretization uses the matrix exponential: $$A=e^{F\Delta t}$$ The sample time should match the system dynamics and sensor timing. Too slow a sample time can miss dynamics. Too fast a sample time can amplify measurement noise, latency error, and computational burden. ## Extended Kalman Filter Linearization Nonlinear process model: $$x_k=f(x_{k-1},u_{k-1})+w_{k-1}$$ Nonlinear measurement model: $$z_k=h(x_k)+v_k$$ Process Jacobian: $$F_{k-1}=\left.\frac{\partial f}{\partial x}\right|_{\hat{x}_{k-1|k-1},u_{k-1}}$$ Measurement Jacobian: $$H_k=\left.\frac{\partial h}{\partial x}\right|_{\hat{x}_{k|k-1}}$$ EKF prediction: $$\hat{x}_{k|k-1}=f(\hat{x}_{k-1|k-1},u_{k-1})$$ Covariance prediction: $$P_{k|k-1}=F_{k-1}P_{k-1|k-1}F_{k-1}^T+Q_{k-1}$$ The EKF can fail if linearization is poor, uncertainty is large, the model is discontinuous, or the state estimate starts far from reality. ## Error Metrics for Validation Prediction error: $$e_i=y_i-\hat{y}_i$$ Mean error: $$\bar{e}=\frac{1}{n}\sum_{i=1}^{n}e_i$$ Root-mean-square error: $$RMSE=\sqrt{\frac{1}{n}\sum_{i=1}^{n}e_i^2}$$ Mean absolute error: $$MAE=\frac{1}{n}\sum_{i=1}^{n}|e_i|$$ Normalized error: $$e_{norm,i}=\frac{e_i}{\sigma_i}$$ Validation should check bias, scatter, outliers, operating modes, uncertainty calibration, and behavior near decision limits. A low RMSE over easy operating conditions may not prove decision-grade performance. ## Prediction-Interval Coverage Empirical coverage: $$C=\frac{n_{inside}}{n_{total}}$$ Coverage error relative to nominal coverage $C_0$: $$e_C=C-C_0$$ If a filter reports 95 percent intervals but only 80 percent of independent validation points fall inside them, the covariance model is overconfident. If nearly all points fall inside very wide intervals, the estimate may be too uncertain to support the decision. ## Tuning and Engineering Interpretation Increasing $Q$ generally makes the estimator adapt faster to measurements but increases estimate variability. Increasing $R$ generally makes the estimator trust the model more and measurements less. Useful tuning evidence includes: - innovation sequence with low bias; - normalized innovation statistics consistent with assumed uncertainty; - validation against independent data; - reasonable response to known disturbances; - stable covariance behavior; - documented performance by operating mode; - review of rejected measurements and false alarms. Tuning should not be used to hide model errors. If the filter works only after unrealistic $Q$ or $R$ values are chosen, the model, sensors, timing, or state definition may be wrong. ## Common Mistakes A common mistake is treating Kalman filtering as an automatic smoothing method. The filter estimates state under assumptions. If those assumptions are violated, a smooth estimate can be misleading. Another mistake is ignoring units and timing. A covariance matrix with inconsistent units, a delayed measurement, or a mismatched timestamp can corrupt the update while leaving the software numerically stable. A deeper mistake is validating only the estimate plot. Engineering validation should test the decision supported by the estimate: control action, maintenance trigger, anomaly flag, inspection priority, navigation state, or safety margin.
REF

See also