🎯 Unscented Kalman Filter

Interactive Visualization of Sigma Points and Nonlinear Transformations

Sigma Points Transform

Input State
Sigma Points
Transformed State
True Nonlinear Transform
Input Mean
0.00
Output Mean
0.00
Input Variance
1.00
Output Variance
1.00

How It Works

The Unscented Kalman Filter uses sigma points to capture uncertainty through nonlinear transformations. Instead of linearizing (like the Extended Kalman Filter), the UKF samples carefully chosen points around the mean.

  • Blue curve: Input state distribution (Gaussian)
  • Green dots: Sigma points (2n+1 = 3 for 1D)
  • Red curve: Output distribution reconstructed from transformed sigma points
  • Yellow curve: True transformation (for comparison)

Try this: Drag the slider to change uncertainty, or select different functions to see how the UKF handles various nonlinearities. Notice how the red curve closely matches the yellow true transformation!

UKF Algorithm Steps

Current Step
1
State Estimate
0.00
Uncertainty
1.00

Step 1: Initialize

Starting with an initial state estimate and covariance. The UKF will predict the next state and then correct it based on measurements.

Why Unscented Kalman Filter?

🎯 Accurate for Nonlinear Systems

Unlike the Extended Kalman Filter (EKF) which linearizes using Jacobians, the UKF directly propagates uncertainty through nonlinear functions using sigma points. This gives better accuracy for highly nonlinear systems.

🔢 No Jacobians Needed

The UKF doesn't require derivatives! You just provide the nonlinear function f(x), and the filter handles the rest. This makes implementation easier and works with non-differentiable functions.

📊 Captures Higher-Order Moments

Sigma points are chosen to match the first two moments (mean and covariance) of the distribution. The UKF captures effects up to 3rd order (Taylor series), while EKF only captures 1st order.

🛡️ Square-Root Formulation

The SR-UKF works with the Cholesky factor S where P = SS'. This guarantees positive definiteness and provides better numerical stability for long-running filters.

🎲 Sigma Point Selection

For n-dimensional state, we use 2n+1 sigma points. They're placed at x̄ ± √((n+λ)P) along each principal axis, plus one at the mean. Parameter λ controls the spread.

⚡ Computational Cost

UKF requires 2n+1 function evaluations per iteration (vs. 1 for EKF plus Jacobian computation). For small to medium n (<20), this is very reasonable on modern hardware.

Mathematical Foundation

1. Sigma Point Generation:

χ₀ = x̄
χᵢ = x̄ + (√((n+λ)P))ᵢ for i = 1,...,n
χᵢ = x̄ - (√((n+λ)P))ᵢ₋ₙ for i = n+1,...,2n

2. Prediction (Process Model):

χᵢ⁻ = f(χᵢ) for all i
x̄⁻ = Σ Wᵢᵐ χᵢ⁻
P⁻ = Σ Wᵢᶜ (χᵢ⁻ - x̄⁻)(χᵢ⁻ - x̄⁻)' + Q

3. Update (Measurement Model):

Υᵢ = h(χᵢ⁻) for all i
ŷ = Σ Wᵢᵐ Υᵢ
K = Pₓᵧ (Pᵧᵧ + R)⁻¹
x̄⁺ = x̄⁻ + K(y - ŷ)

Where Wᵢᵐ and Wᵢᶜ are weights chosen to satisfy moment-matching conditions.