Unscented Kalman Filter
March 23, 2026 · View on GitHub
Overview & Motivation
The Extended Kalman Filter (EKF) linearizes nonlinearities using Jacobians. This works well for mild nonlinearities, but the first-order approximation can introduce significant errors when:
- The nonlinear functions are highly curved (large second derivatives).
- The state uncertainty is large (the linearization point is far from the true state).
- Jacobians are difficult or expensive to derive analytically.
The Unscented Kalman Filter (UKF) addresses all three problems by replacing linearization with a deterministic sampling approach. Instead of approximating the nonlinear function, it approximates the probability distribution by choosing a small set of carefully weighted sample points — called sigma points — and propagating them through the true nonlinear function. The statistics (mean and covariance) are then reconstructed from the transformed points.
This captures the true mean and covariance to second-order accuracy for any nonlinearity, without computing a single Jacobian.
Mathematical Theory
Sigma Point Generation
Given state estimate and covariance , generate $2n+1$ sigma points:
where denotes the -th column of the matrix square root (Cholesky decomposition , using columns of ), and:
Weights
Parameters:
- : Controls spread of sigma points ($10^{-4} \leq \alpha \leq 1$). Smaller values keep points closer to the mean.
- : Incorporates prior knowledge about the distribution ( is optimal for Gaussian).
- : Secondary scaling parameter (typically or ).
Predict Step
- Propagate sigma points through the nonlinear state transition:
- Reconstruct predicted state and covariance:
Update Step
-
Generate new sigma points from the predicted state and .
-
Transform sigma points through the measurement function:
- Predicted measurement and covariances:
- Kalman gain and state update:
Complexity Analysis
| Operation | Time | Space | Notes |
|---|---|---|---|
| Sigma point gen | Dominated by Cholesky decomposition | ||
| State propagation | = cost of evaluating | ||
| Mean/cov reconstruct | Weighted outer products | ||
| Update | Same as standard Kalman for the gain computation | ||
| Total per step | Cholesky and sigma point propagation dominate |
For , the additional cost over EKF is small — and the elimination of Jacobian derivation is a significant engineering benefit.
Step-by-Step Walkthrough
System: Same pendulum as the EKF example, , , s.
Parameters: , , → .
Initial: , .
- Generate 5 sigma points from and using Cholesky of .
- Propagate each sigma point through (pendulum dynamics).
- Reconstruct and from the weighted transformed points.
- Generate new sigma points from and .
- Transform through for the measurement update.
- Compute , , and update state and covariance.
The UKF naturally captures the curvature of without computing — the sigma points "feel" the nonlinearity directly.
Pitfalls & Edge Cases
- Covariance non-positive-definiteness. Numerical errors or extreme sigma point spread can make lose positive-definiteness, causing the Cholesky decomposition to fail. Use a small regularization term or the square-root UKF variant.
- Alpha tuning. Very small (e.g., $10^{-4}w_0^{(c)}\alpha (e.g., \0.1$) is safer for low-dimensional systems.
- Sigma point overflow. For fixed-point types, the scaled columns may exceed the representable range. Use float for the UKF or carefully bound the covariance.
- Non-Gaussian distributions. The UKF assumes a Gaussian approximation. For multi-modal or heavily skewed distributions, consider particle filters.
- Computational cost. For large state dimensions (), the $2n+1O(n^3)$ Cholesky become significant. Consider sparsification or reduced-rank approximations.
Variants & Generalizations
- Square-Root UKF (SR-UKF). Propagates the Cholesky factor (where ) instead of directly, using QR decompositions and rank-1 Cholesky updates. Guarantees positive-definiteness and improves numerical stability.
- Augmented UKF. Augments the state vector with the process and measurement noise vectors, generating sigma points in the joint space. Captures correlations between state and noise at the cost of more sigma points ($2(n + n_w + n_v) + 1$).
- Reduced Sigma Point Filters. Use fewer than $2n + 1n + 2$ points) to reduce computation for large state dimensions.
- UKF with Control Input. The state transition becomes and each sigma point is propagated as . Supported in the implementation via the
ControlSizetemplate parameter. - Cubature Kalman Filter (CKF). A special case of the UKF with , , , using third-degree spherical-radial cubature rules. Simpler weight computation with no negative weights.
Comparison with Other Filters
| Filter | Jacobian Required? | Accuracy Order | Handles High Nonlinearity? | Computational Cost |
|---|---|---|---|---|
| Kalman Filter | No (linear only) | Exact (linear) | No | Lowest |
| EKF | Yes | 1st order | Moderate | Low |
| UKF | No | 2nd order | Good | Moderate |
| Particle | No | Arbitrary | Excellent | High |
Applications
- Attitude estimation — Quaternion-based orientation estimation (avoiding gimbal lock and Jacobian complexity).
- Target tracking — Radar/lidar tracking with range-bearing measurements (highly nonlinear in Cartesian coordinates).
- Robotics — State estimation for mobile robots and manipulators with nonlinear kinematics.
- Chemical processes — Concentration estimation in nonlinear reaction kinetics.
- Power systems — Dynamic state estimation in electrical grids with nonlinear power flow equations.
Connections to Other Algorithms
graph LR
UKF["Unscented Kalman Filter"]
KF["Kalman Filter"]
EKF["Extended Kalman Filter"]
CHO["Cholesky Decomposition"]
UKF -->|"linear limit"| KF
EKF -->|"alternative to"| UKF
CHO -->|"sigma points"| UKF
| Algorithm | Relationship |
|---|---|
| Kalman Filter | The UKF reduces to the standard KF when and are linear |
| Extended Kalman Filter | Uses Jacobians instead of sigma points; simpler but less accurate for nonlinear cases |
| Cholesky Decomposition | Used internally to generate sigma points from the covariance matrix |
References & Further Reading
- Julier, S.J. and Uhlmann, J.K., "A New Extension of the Kalman Filter to Nonlinear Systems", in Proc. AeroSense, 1997.
- Julier, S.J. and Uhlmann, J.K., "Unscented Filtering and Nonlinear Estimation", Proceedings of the IEEE, 92(3), 2004.
- Wan, E.A. and van der Merwe, R., "The Unscented Kalman Filter for Nonlinear Estimation", in Proc. IEEE Adaptive Systems for Signal Processing, 2000.
- Simon, D., Optimal State Estimation: Kalman, H∞, and Nonlinear Approaches, Wiley, 2006 — Chapter 14.