3.5.25 · D3Guidance, Navigation & Control (GNC)

Worked examples — Unscented Kalman Filter (UKF) — sigma points, better for nonlinear

3,663 words17 min readBack to topic

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

  1. 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 .

  2. Weights. , and . With the correction , so . Why this step? makes — no scaled-UT correction, so we can compare cleanly to plain Kalman.

  3. Transform. Why this step? We apply the actual , not a linearization — but is linear here, so this is the exact map.

  4. Recover mean (use ). Why this step? The terms cancel; symmetric points give a symmetric mean.

  5. 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

  1. 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.

  2. 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.

  3. 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

  1. 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 .
  2. Transform. . Why this step? True at each shifted sample — the cross-term is exactly the curvature information EKF discards.
  3. 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 .
  4. 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)

Figure — Unscented Kalman Filter (UKF) — sigma points, better for nonlinear
Figure 1. The lavender curve is the 1-sigma uncertainty ellipse of . The single coral dot is the centre sigma point ; the four mint dots are the outer points. Two straight measuring arrows are drawn: the coral arrow (wide axis, variance ) reaches ; the slate arrow (narrow axis, variance ) reaches . Every colour is called out once in the legend so nothing is ambiguous. Axes are the two state components . Notice the points sit on the ellipse's axes, not randomly scattered.

  1. 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).
  2. 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.
  3. 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

  1. Sigma points. : . Why this step? Outer points at reproduce the prior variance ; we propagate the prior uncertainty, nothing more yet.
  2. Propagate. : , , . Why this step? True dynamics on each point — the bumps both outer points up by , which is the curvature the EKF would miss.
  3. 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.
  4. 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.
  5. 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)

Figure — Unscented Kalman Filter (UKF) — sigma points, better for nonlinear
Figure 2. The coral dot at the origin is , where . The four mint dots are the outer sigma points; the mint arrows are the vectors from the origin to each; the butter dashed circle marks radius . Every mint arrow has the same length — that is why the averaged range is . Axes are the state components . The EKF's Jacobian would need a slope at the coral dot, where has a sharp corner — the UT never asks for it.

  1. 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.
  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.
  3. 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

  1. 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 .
  2. 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 .
  3. 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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

  1. 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.
  2. 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.
  3. 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.
  4. 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

  1. 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.
  2. 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.
  3. 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
Use for the mean, (with ) for the covariance — never swap them.
Why add
Sigma points carry only prior uncertainty; process noise is added after propagation or the filter grows overconfident.
UT vs EKF on
UT gives exact ; EKF gives because the Jacobian .

Related: Extended Kalman Filter (EKF) · Kalman Filter (linear) · Particle Filter · Cholesky Decomposition · Taylor Series Expansion · State Estimation in GNC · Nonlinear Systems.