Worked examples — Unscented Kalman Filter (UKF) — sigma points, better for nonlinear
This is a Deep Dive child of Unscented Kalman Filter (UKF). The parent built the machinery — sigma points, weights, the transform. Here we stress-test it against every kind of situation a real filter meets: gentle curvature, brutal curvature, the exact quadratic that fools an EKF, a degenerate covariance, a full predict step with noise, and a non-differentiable measurement where the EKF's Jacobian literally does not exist.
Before we start, one reminder in plain words. A sigma point is a hand-picked sample of the state. A weight is how much we trust that sample when we re-build a mean or a spread. We push each sample through the true nonlinear function and re-read the statistics. No derivatives. Ever.
The weight formulas, restated once so nothing appears unearned
Every example below uses the same two weight sets from the parent. Because a reviewer (rightly) flagged that the covariance-weight correction kept showing up unexplained, here is the complete rulebook in one place, in plain words, before any example uses it.
Two everyday choices you will see below:
- : then , so — the mean and covariance weights coincide. Used in Examples 1–7, 9, 10 for clean arithmetic.
- (e.g. ), : the scaled UT of Example 8, where the correction genuinely matters.
Throughout, unless stated, we use = state dimension and .
The scenario matrix
Every UKF question falls into one of these cells. The examples below are labelled with the cell(s) they cover, so by the end no cell is empty.
| # | Case class | What makes it tricky | Covered by |
|---|---|---|---|
| A | Linear | UT must reduce to the plain [[Kalman Filter (linear) | Kalman filter]] answer exactly |
| B | Symmetric quadratic , mean | EKF Jacobian is zero → EKF blind, UT must see it | Ex 2 |
| C | Nonzero-mean nonlinearity | Curvature and offset both matter | Ex 3 |
| D | 2D / covariance shape | matrix square root, spread along principal axes | Ex 4 (fig) |
| E | Full predict step with | remember to add process noise | Ex 5 |
| F | Non-differentiable | EKF Jacobian undefined at origin; UT is fine | Ex 6 (fig) |
| G | Degenerate / zero variance | one direction has no uncertainty; points collapse | Ex 7 |
| H | Scaled UT, tiny | limiting behaviour, correction saves covariance | Ex 8 |
| I | Word problem (real GNC) | translating a physical scenario into | Ex 9 |
| J | Exam twist: sign/weight trap | using where belongs | Ex 10 |
Example 1 — Cell A: the linear sanity check
-
Sigma points. Matrix square root: . Why this step? The three points must reproduce mean and variance ; they sit symmetric about so the mean is untouched and their spread carries .
-
Weights. , and . With the correction , so . Why this step? makes — no scaled-UT correction, so we can compare cleanly to plain Kalman.
-
Transform. Why this step? We apply the actual , not a linearization — but is linear here, so this is the exact map.
-
Recover mean (use ). Why this step? The terms cancel; symmetric points give a symmetric mean.
-
Recover covariance (use ). Deviations from : . Why this step? Covariance is the weighted mean of squared deviations; the centre point contributes nothing here because its deviation is .
Recall Verify
Kalman prediction ::: ✔, ✔ — the UT reproduces the linear filter exactly. As it must.
Example 2 — Cell B: the quadratic that blinds the EKF
-
Sigma points. , so . Why this step? We refuse to linearize; the two outer points are placed at precisely so their weighted spread reproduces the true variance — we sample where the uncertainty actually lives.
-
Transform. . Why this step? Squaring both outer points gives the same positive value — curvature shows up as an upward shift the EKF's zero slope never sees.
-
Mean (use ). . Why this step? Even though the centre point maps to , the two lifted outer points drag the weighted average up to — the whole point of not linearizing.
Recall Verify
True mean of ::: — the UT is exact, EKF gives (100% wrong). For : UT says , EKF says .
Example 3 — Cell C: nonzero mean, curvature + offset
- Sigma points. , so . Why this step? The points are centred on the actual mean (not ) and stepped out by so their spread equals — mean and covariance of are both reproduced before we touch .
- Transform. . Why this step? True at each shifted sample — the cross-term is exactly the curvature information EKF discards.
- Mean (use ). Why this step? The terms cancel in the average; what survives is the curvature bias that lifts the mean above to the true .
- Covariance (use ). Deviations from : . ; their sum is . Why this step? Squaring the deviations and weight-averaging is the definition of variance; here so , and the centre deviation does contribute.
Recall Verify
Both moments ::: (true ) ✔ and (true ) ✔ — the UT captures mean and spread exactly for a quadratic through a Gaussian.
Example 4 — Cell D: 2D covariance, spread along principal axes (figure)

- Matrix square root. Since is diagonal, (this is the Cholesky factor). Scale: , columns and . Why this step? The columns of the scaled square root are the principal directions — how far to step along each axis of the uncertainty ellipse (the lavender curve in Figure 1).
- Sigma points. (coral dot); and (the four mint dots). Why this step? Compare the two measuring arrows in Figure 1: the wide axis (variance ) pushes points out to , the narrow axis (variance ) only to — the point cloud is stretched exactly like the ellipse, so it carries the correct shape.
- Weights. ; for the four outer points. Why this step? With the centre carries zero mean-weight — the four symmetric points alone rebuild the mean (which is why the coral dot in Figure 1 does not bias anything).
Recall Verify
Reconstruct ::: -variance ✔; -variance ✔; cross term ✔.
Example 5 — Cell E: a full predict step, remember
- Sigma points. : . Why this step? Outer points at reproduce the prior variance ; we propagate the prior uncertainty, nothing more yet.
- Propagate. : , , . Why this step? True dynamics on each point — the bumps both outer points up by , which is the curvature the EKF would miss.
- Predicted mean (use ). Why this step? The cancel; the surviving on each outer point, weighted, drifts the mean to — the curvature, not any input mean, produced it.
- Predicted covariance before (use ). Deviations from : . , , sum . Why this step? Same variance recipe as before ( so ); this measures how the propagated points spread — but it is only prior uncertainty carried forward.
- Add process noise. Why this step? Sigma points carry only prior uncertainty; is the new uncertainty the world injects each step. Forget it and the filter becomes overconfident and diverges.
Recall Verify
Predict outputs ::: , — confirmed by direct weighted sums.
Example 6 — Cell F: non-differentiable measurement (figure)

- Sigma points. : , , . Why this step? , std in each direction, so outer points land at radius — exactly the mint dots on the butter circle in Figure 2.
- Push through . ; each outer point has . So . Why this step? is evaluated, never differentiated — the origin corner (visible as the coral dot in Figure 2) simply never enters the arithmetic.
- Weights & mean (use ). , . Why this step? Look at Figure 2: the four mint arrows all have length , so the measured range averages to — a finite, sensible, derivative-free estimate exactly where the EKF breaks.
Recall Verify
finite where EKF fails ::: ✔; the EKF Jacobian at origin is , undefined.
Example 7 — Cell G: degenerate / zero-variance direction
- Square root. ; scaled columns and . Why this step? A zero eigenvalue produces a zero column, so the transform automatically refuses to spread along a direction with no uncertainty — there is no divide-by-zero because we take a square root, never an inverse, of .
- Sigma points. ; ; . Why this step? The second pair inherits the zero column, so they land exactly on the centre — they still hold weight but sit on , keeping every point on the line .
- Reconstruct. All points have exactly → reconstructed variance in is ✔. In : ✔. Why this step? The variance recipe over -deviations gives automatically, and over -deviations gives — the degenerate case needs no special handling.
Recall Verify
Degenerate handled ::: -variance rebuilt , -variance — both exact; sigma points never leave .
Example 8 — Cell H: scaled UT, tiny , the rescue
- Compute from its definition. Use the actual formula, not a shortcut: So . Keep exact (); do not round it to , because the weights below divide by the tiny and any rounding of corrupts them.
- Sigma points. , , . Why this step? With such small , the outer points barely leave the mean — we sample only very locally, which is exactly what the scaled UT is designed to do.
- Mean weights (use ). , a large negative number; , huge. Why this step? Points hug the mean, so their weights must blow up (and the centre goes negative) to keep the reconstructed spread of correct — this is the price of local sampling.
- Transform & mean. . Why this step? The tiny transformed values times giant weights recombine to exactly — locality of sampling did not cost accuracy in the mean.
- Covariance weight (use ). . This extra on the centre repairs the covariance that the tight spacing would otherwise underestimate. Why this step? is the Gaussian-optimal correction; it lives only in (per the rulebook at the top), so the mean of step 4 is untouched — that is precisely why we could keep .
Recall Verify
Limit stays exact ::: even for ✔ — proof the scaled UT does not sacrifice the mean.
Example 9 — Cell I: real GNC word problem
- Translate the physics into . Altitude is the state; its range is km. Covariance . Why this step? The UT needs a mean and covariance; the word "std km" is the covariance once squared. This is the modelling move that turns a physical scenario into filter inputs.
- Sigma points. : . Why this step? Points span std of altitude — the actual band of altitudes the sensor might be reading, so the transform samples the true operating range.
- Push through . ; ; . Why this step? The far (high) point loses more power than the near (low) point gains — that asymmetry is the convex bias the EKF's straight-line slope cannot capture.
- Mean (use ). Why this step? Weight-averaging the transformed points; the convexity nudges above the naive , which is the physically correct answer an EKF misses.
Recall Verify
Convex bias ::: ✔ — the expected power is higher than the plug-in value, the correct convex (Jensen) effect.
Example 10 — Cell J: exam twist, the weight trap
- Correct mean (use ). regardless of : reusing Example 3, . Why this step? By the rulebook at the top, lives only in ; the mean must be -independent by construction.
- Wrong mean (misusing ). The weights no longer sum to : . Plugging in: Why this step? Weights that sum to instead of inflate every contribution — the "mean" balloons to , carrying the spurious footprint.
- Diagnosis. The correct value is ; the error is , precisely the leak from putting a covariance weight where a mean weight belongs. Why this step? Isolating the size of the error to exactly the correction term shows why the rule "means use " exists — swapping weights injects the covariance correction into the mean.
Recall Verify
Weight trap ::: correct , wrong ; the error equals the misused term — always use for means.
One-line recall
Correct-vs-wrong mean weight
Why add
UT vs EKF on
Related: Extended Kalman Filter (EKF) · Kalman Filter (linear) · Particle Filter · Cholesky Decomposition · Taylor Series Expansion · State Estimation in GNC · Nonlinear Systems.