The E-K-F draws a tangent line through a curved world and quietly lies. The U-K-F refuses to. Its trick is a beautiful flip: instead of approximating the curve, approximate the cloud of uncertainty — pick a few clever points, push them through the real nonlinearity, and read the answer off the warped result. No Jacobians, no tangent line, no quiet lie.
You are tracking a robot with a single distance sensor — a cheap beacon bolted to the wall that reports how far away the robot is, but not in which direction. The robot is somewhere out in front of it, and you have a fuzzy belief about where: roughly two meters away, give or take. You want to turn that "distance reading" into a guess about the robot's position. Simple, except for one cruel fact of geometry: distance is the square root of the sum of squared coordinates. The map from "where the robot is" to "what the sensor reads" is curved, not straight. And on a curve, the trick everyone reaches for first — drawing a straight tangent line and pretending the world is flat near it — goes wrong in a way that is hard to see and easy to ship.
That tangent-line trick is the Extended Kalman Filter (E-K-F), the workhorse from Lesson 7. When a sensor or a motion model is nonlinear, the E-K-F replaces the curve with a straight line tangent to it at your current best guess, then runs the ordinary Kalman math on that line. It is fast, it is famous, and on gentle curves it is wonderful. But on a sharp curve it commits a subtle crime: it reports the wrong center of your uncertainty. The estimate becomes biased — not just noisier, but systematically off in one direction — and a biased filter is far more dangerous than a merely noisy one, because no amount of averaging will save you. You are confidently wrong.
Here is the precise picture, and it is the seed of this entire lesson. Your uncertainty about the robot's state is a little cloud — a spread of plausible positions. You want to know: after I push this cloud through the curved sensor function, where does the transformed cloud's center land? The E-K-F answers by pushing only the center of your cloud through the curve, then drawing a tangent line and stretching the spread along it. But on a curve, the center of the transformed cloud is not the transform of the center. Bend a spread of points around a curve and they bunch up on one side — the true average of the warped points lands somewhere the tangent line never sees.
Let's watch it before we name anything. Below, a Gaussian cloud of uncertainty (the blue points) sits on the left. A curved function bends it as it passes through, producing the warped orange cloud on the right. Compare two answers for "where is the center of the warped cloud?": the true mean of all the warped points, versus the E-K-F's tangent-line guess, which is just the curve applied to the input center. Crank the curvature slider and watch the gap between them open up.
A cloud of input points (your uncertainty) is pushed through a curved function and lands as the warped cloud. The true mean is the actual average of the warped points. The E-K-F estimate is the curve applied to the input center only (the tangent-line answer). On a straight function they agree. Drag the curvature up and watch them split — the E-K-F mean drifts away from the truth.
Notice two things as you play. First, at zero curvature (a straight line) the green and red marks sit exactly on top of each other — for a linear function the tangent line is the function, so the E-K-F is exact. Second, the moment you add curvature, the warped cloud lopsides — more points pile up on the steep side — and its true center (green) slides away from the E-K-F's tangent answer (red). The wider you make the spread, the bigger the gap, because a wider cloud reaches further into the curved region where the linear approximation breaks down. Sharp curve plus wide uncertainty equals large bias. That is exactly the regime where the E-K-F fails and where the rest of this lesson lives.
"A small bias in a position estimate" sounds academic until you remember where these filters live. A spacecraft estimating its attitude from star trackers and gyros is fusing through trigonometric curves — sines and cosines of angles — with very tight accuracy demands; a biased estimate points the antenna at empty sky. A GPS receiver turning satellite ranges into a position fixes a profoundly nonlinear set of distance equations; bias here is a car in the wrong lane. A robot fusing bearing measurements (angles to landmarks) is working with atan2, one of the most viciously curved functions there is. In all of these, the E-K-F's tangent line is not a harmless simplification — it is a structural source of error that grows precisely when the uncertainty is large, which is exactly when you most need the filter to be right.
And the cure is not "linearize more carefully" or "use a smaller step." Those help a little. The cure, due to Simon Julier and Jeffrey Uhlmann in 1997, is to stop linearizing at all — to flip the whole problem on its head. That flip is so clean it feels like a magic trick the first time you see it, and it is the subject of Chapter 2. But first, one chapter to make sure the E-K-F's exact failure is crisp in your mind, because the U-K-F is best understood as the precise fix for that exact failure.
Before we build the new thing, let's pin down the old thing in one tight chapter, because the U-K-F is the answer to a question the E-K-F asks badly. If Lesson 7 is fresh, skim this; if it's hazy, this is the part you need.
The plain Kalman filter (Lesson 5) is a perfect fuser when everything is linear: when your motion model and your sensor model are both straight-line maps of the form "output equals a matrix times the state." Under that linearity, the Kalman filter is provably optimal — no estimator does better. The trouble is that the real world is rarely linear. A range sensor reads distance, which is a square root. A bearing sensor reads an angle, which is an arctangent. A car's motion bends through sines and cosines of its heading. The clean matrix the Kalman filter needs simply isn't there.
The E-K-F's answer is the most natural thing a calculus student would try: replace the curve with its tangent line at the current estimate. Concretely, take the nonlinear sensor function h(x) — the map from state to measurement — and approximate it near your best guess x̂ by the first two terms of its Taylor expansion:
where H is the Jacobian — the matrix of partial derivatives of h, evaluated at x̂. That Jacobian is the slope of the tangent line (in many dimensions, the slopes in every direction at once). Once you have H, you pretend the world is linear with that slope and run the ordinary Kalman update. The E-K-F is "Kalman filter on the local tangent plane."
The E-K-F carries two distinct burdens, and the U-K-F was designed to kill both at once. Keep them separate in your mind:
Cost 1 — you must compute the Jacobian. For every nonlinear model in your system, you must work out the matrix of partial derivatives by hand (or symbolically), code it, and re-evaluate it every single step. For a simple range sensor that's a quick derivative. For a 15-state inertial navigation model fusing GPS, IMU, and magnetometer through messy trigonometry, the Jacobian is a dense, error-prone matrix that engineers dread. A single sign error in one partial derivative produces a filter that looks like it's working — it converges, it tracks — but is subtly, persistently wrong. These bugs are notorious.
Cost 2 — the tangent line biases the mean (Chapter 0's crime). Even with a perfectly correct Jacobian, the linear approximation is only accurate to first order. The curvature — the second-order behavior, the very thing that bends a tangent line off the curve — is thrown away. So the transformed mean is wrong by an amount that grows with the curvature and with the size of your uncertainty, exactly as you saw in the Chapter 0 sim.
| The E-K-F's choice | The consequence |
|---|---|
| Approximate the function with a tangent line | Need the Jacobian (Cost 1) and lose the curvature (Cost 2) |
| Accurate to first order only | Bias grows with curvature × uncertainty |
| Exact only when the function is linear | Fine on gentle curves, biased on sharp ones |
Here is the question that opens the door to the U-K-F. The E-K-F's whole strategy is built on approximating the function — replacing the hard, curved h(x) with an easy, straight line. What if that's the wrong thing to approximate? The function is fixed and curved; fighting it with a tangent line is fighting its nature. But the thing we actually care about — our uncertainty — is just a cloud of points, and a cloud is a much simpler object than a function. What if we approximated the cloud and left the function alone? That single change of target is the U-K-F, and it's the next chapter.
Here is the idea, in one sentence, that the rest of the lesson elaborates: it is easier to approximate a probability distribution than it is to approximate an arbitrary nonlinear function. Julier and Uhlmann put it almost exactly that way in 1997, and it is the whole U-K-F in a thought. Let it land before we make it mechanical.
Think about what each object is. A nonlinear function — like a range sensor's square root, or a bearing sensor's arctangent — can twist and bend in infinitely many ways. To capture all of its behavior with a straight line is hopeless; the line is only ever right at one point. That's the E-K-F's bind: it's trying to summarize an infinitely-rich curved object (the function) with the crudest possible summary (a line).
Now think about what we're actually uncertain about. Our belief about the state is a Gaussian — a cloud described by just two things: its mean (where it's centered) and its covariance (how spread out it is, and in which directions). That's it. A Gaussian, however high-dimensional, is pinned down completely by a center and a spread. It is a finite, simple object. And here's the leap: a center and a spread can be captured exactly by a small, finite set of sample points — you don't need a thousand random samples, you need a handful of carefully placed ones.
Picture the difference physically. The E-K-F takes your cloud, finds its center, draws a tangent line through that one center point, and slides the whole cloud along the line. Every point in the cloud is being told "pretend the curve is the tangent line here." Points far from the center get this badly wrong, because out there the curve has peeled away from the line.
The U-K-F does something honest instead. It places a few representative points across your cloud — one at the center, a few out toward the edges of the spread — and then it asks the actual curve, "where does each of these points really go?" It pushes them through h(x) itself, no approximation. The points that started near the edge of the spread land wherever the true curve sends them, bunching and stretching exactly as the real nonlinearity dictates. Then it looks at where the warped points landed and computes their average and spread. That average naturally captures the lopsidedness the tangent line missed — because the points really went there.
This isn't just hand-waving better; it's provably better, and the proof has a clean headline. The E-K-F captures the transformed mean to first order in a Taylor sense — it gets the linear part right and discards everything curved. The unscented transform (the engine we build next chapter) captures the transformed mean to at least second order for any nonlinearity, and to third order when the underlying distribution is Gaussian. In plain terms: it correctly accounts for the leading curvature term — the exact term the E-K-F throws away — which is why the green and red marks in the Chapter 0 sim agreed for a line but split for a curve.
The flip rests on one claim that needs earning: that a Gaussian cloud — an infinite spread of possibilities — can be represented by a tiny, finite set of points. Not approximated loosely; represented exactly, in the sense that those few points carry precisely the cloud's mean and covariance. The points that do this job are called sigma points, and choosing them is the heart of the unscented transform.
The name is a clue: the points are placed at the sigma (the standard deviation) of the distribution — out at the edges of the spread, not scattered randomly. The recipe is almost insultingly simple. For a state with n dimensions, you use 2n + 1 sigma points:
So a 1-dimensional state (n = 1) gets 3 sigma points: the mean, one to the right, one to the left. A 2-dimensional state gets 5; a 3-dimensional state gets 7; the 15-dimensional inertial navigation state gets 31. The count grows only linearly with dimension — that's the difference between this and a brute-force Monte Carlo that would need thousands of samples.
Consider the simplest case: a 1-D Gaussian with mean μ = 2 and variance P = 4 (so a standard deviation of 2). We need three sigma points. The center one is easy: it sits at the mean, μ = 2. The other two step out from the mean by an amount governed by the covariance. The step is the square root of a scaled covariance:
where n is the state dimension (here 1) and λ (lambda) is a scaling parameter — a single tuning knob that controls how far out the points reach. We'll treat λ's exact value in Chapter 8; for now take the common choice λ = 2 for a 1-D problem (it comes from λ = α²(n + κ) − n with the standard defaults, but the value is all we need here). Plug in:
So the three sigma points are:
| Sigma point | Location | Value |
|---|---|---|
| χ0 (center) | μ | 2 |
| χ1 (plus) | μ + step | 2 + 3.46 = 5.46 |
| χ2 (minus) | μ − step | 2 − 3.46 = −1.46 |
Three numbers — 2, 5.46, −1.46 — now stand in for the entire Gaussian. The center captures the mean; the symmetric ±3.46 pair captures the spread. (In many dimensions, the "step" becomes a step along each direction the covariance stretches, computed from a matrix square root of P — the multidimensional cousin of √P — but the spirit is identical: step out along the axes of the spread.)
Pushing the points through the function isn't enough; when we rebuild the cloud on the far side, we'll take a weighted average of the warped points, and each sigma point carries its own weight. Why weighted? Because the center point and the edge points play different roles, and the math of matching a Gaussian's moments demands they count differently. There are two sets of weights — one set for recombining the mean (call them Wm) and one for the covariance (Wc) — and they share the same simple structure:
Run our 1-D numbers (n = 1, λ = 2, so n + λ = 3): the center weight is W0m = 2/3 ≈ 0.667, and each of the two edge points gets 1/(2×3) = 1/6 ≈ 0.167. Sanity check — the weights must sum to 1 (it is an average, after all): 0.667 + 0.167 + 0.167 = 1.00. ✓ The center point dominates (two-thirds of the vote) and the two edge points split the remaining third, which makes intuitive sense: the center is the most likely state, the edges are the less-likely tails.
Below, set a 1-D Gaussian's mean and spread and watch the three sigma points place themselves — the center on the mean, the symmetric pair stepped out by √((n+λ)P). The numbers update live so you can match them against the worked example above (try μ=2, and read off ≈5.46 and ≈−1.46).
The curve is your Gaussian belief. The three sigma points are placed on it: one at the mean, two stepped out by √((n+λ)·P). Adjust the mean and spread and watch the points track. The bar heights show each point's weight — the center dominates, the edges split the rest, and they always sum to 1.
For a 1-D state the whole thing is short. Notice there is no derivative, no Jacobian — only a square root of the covariance to find the step:
python import numpy as np def sigma_points_1d(mu, P, n=1, lam=2.0): step = np.sqrt((n + lam) * P) # how far the ± points reach pts = [mu, mu + step, mu - step] # center, plus, minus # weights: center gets lam/(n+lam); each edge gets 1/(2(n+lam)) Wm = [lam/(n+lam), 1/(2*(n+lam)), 1/(2*(n+lam))] return np.array(pts), np.array(Wm) pts, Wm = sigma_points_1d(2.0, 4.0) # pts -> [ 2. 5.46 -1.46 ] Wm -> [0.667 0.167 0.167] (sums to 1.0)
That's the entire sigma-point machinery. Three points and three weights stand in for a Gaussian, computed with a square root and no calculus. In the next chapter we feed these three points through a real nonlinear function and watch the cloud reassemble — correctly — on the other side.
We have the sigma points. Now we run the actual maneuver — the unscented transform — and watch it beat the E-K-F on a real curve, by hand, with real numbers. The whole procedure is three steps, and once you've done it once you own it forever:
We'll use the cleanest curved function there is: y = x². It's a parabola — gentle near zero, steep far out — and crucially, we can compute the true answer exactly and check our work. Our input is the 1-D Gaussian from Chapter 3: mean μ = 2, variance P = 4. The question: after squaring, what is the mean of the output?
The naive (E-K-F-style) guess first. The tempting answer is "just square the mean": f(μ) = 2² = 4. This is exactly what the E-K-F's tangent line reports — it evaluates the function at the center and calls that the output mean. Hold onto the number 4; we'll see it's wrong.
The true answer, for reference. For y = x² with input mean μ and variance P, calculus gives the exact output mean: E[x²] = μ² + P = 2² + 4 = 4 + 4 = 8. The true mean of the squared cloud is 8, not 4 — the variance adds 4 to the naive guess, because squaring stretches the far-out points more than the near ones, dragging the average upward. The E-K-F's "4" is off by a full 100%. This is the bias from Chapter 0, made arithmetic.
Now the unscented transform. We push our three sigma points (computed in Chapter 3: χ = [2, 5.46, −1.46], weights Wm = [0.667, 0.167, 0.167]) through y = x²:
| Sigma point χi | Warped 𝒬i = χi² | Weight Wim | Contribution Wi·𝒬i |
|---|---|---|---|
| 2.00 | 2.00² = 4.00 | 0.667 | 0.667 × 4.00 = 2.668 |
| 5.46 | 5.46² = 29.81 | 0.167 | 0.167 × 29.81 = 4.978 |
| −1.46 | (−1.46)² = 2.13 | 0.167 | 0.167 × 2.13 = 0.356 |
Now sum the contributions to get the recovered output mean:
The unscented transform recovers 8.00 — exactly the true mean. Not close, exactly. Compare the scoreboard:
| Method | Output mean for y=x², input N(2, 4) | Error |
|---|---|---|
| True answer (calculus) | 8.00 | — |
| Unscented transform | 8.00 | 0.00 — exact! |
| E-K-F (square the mean) | 4.00 | −4.00 (off by 100%) |
Sit with that. The E-K-F said the squared cloud is centered at 4; the truth is 8; the unscented transform — using only three points and a square root, no Jacobian, no calculus — nailed 8. It "saw" the curvature because it let the curve act on the spread-out sigma points (the one at 5.46 squared to a huge 29.81 and pulled the average up), exactly as the true distribution does. The E-K-F never saw it because it only ever evaluated the curve at the single center point.
The transform doesn't just recover the mean — it recovers the output covariance the same way, as a weighted average of how far each warped point lands from the recovered mean. For each warped point compute its deviation (𝒬i − μy), square it, weight it (with the covariance weights Wc), and sum:
So one pass of "push the points" hands you back both the new mean and the new spread — a complete Gaussian on the output side. That is everything a Kalman-style filter needs to keep going. The function was never approximated; we only ever evaluated it at points and measured the result.
python import numpy as np def unscented_transform(mu, P, f, n=1, lam=2.0): # 1. choose sigma points (1-D) step = np.sqrt((n + lam) * P) chi = np.array([mu, mu + step, mu - step]) Wm = np.array([lam/(n+lam), 1/(2*(n+lam)), 1/(2*(n+lam))]) # 2. push EACH point through the TRUE function (no Jacobian!) Y = np.array([f(c) for c in chi]) # 3. recover mean and covariance from the warped points mu_y = np.sum(Wm * Y) P_y = np.sum(Wm * (Y - mu_y)**2) return mu_y, P_y mu_y, P_y = unscented_transform(2.0, 4.0, lambda x: x**2) # mu_y -> 8.0 (the EKF would say 4.0) true answer = 8.0 ✓
Run it in your head: f is x**2, the three sigma points get squared, the weighted sum is 8.0. Swap f for any function — a square root for a range sensor, an atan2 for a bearing sensor — and the same three lines work, because we never differentiated f. That generality, with no Jacobian to derive, is the U-K-F's quiet superpower.
Below, push a draggable Gaussian through y = x² and watch the unscented transform recover the mean exactly while the E-K-F's "square the mean" sits stubbornly low. The three sigma points are shown squaring themselves; their weighted average is the green mark, the truth is the dashed line, and the E-K-F is the red mark.
Set the input mean and variance. The three sigma points get squared (watch them on the parabola). The U-T mean is their weighted average; the E-K-F mean is just (mean)²; the dashed line is the true mean μ²+P. The U-T sits on the truth; the E-K-F sits low by exactly P.
We have the engine — the unscented transform turns "Gaussian in, nonlinear function, Gaussian out" into a few points pushed through the true curve. A full filter is just that engine run twice per timestep: once for the predict step (push the belief through the motion model) and once for the update step (push the predicted belief through the sensor model and fuse with the measurement). Same Kalman skeleton you already know — predict, then correct — with the unscented transform standing in wherever the old filter needed a linear map.
The motion model f(x) says how the state evolves from one tick to the next (a car drives forward and turns; a satellite tumbles). It's usually nonlinear — sines and cosines of heading, for instance. The U-K-F predict step is exactly the unscented transform applied to f:
The output is a predicted Gaussian: where we think the state is now, before looking at any sensor, and how unsure we are. No Jacobian of f was ever taken.
Now a sensor reports a measurement z. The sensor model h(x) maps state to expected measurement (often the curved one — range, bearing). The update step runs a second unscented transform, this time through h, and then does the Kalman correction:
| Step | E-K-F does… | U-K-F does… |
|---|---|---|
| Predict mean | f(x̂) at the center only | weighted avg of f(χi) over all sigma points |
| Predict covariance | F·P·FT + Q (F = Jacobian of f) | weighted spread of moved sigma points + Q |
| Measurement coupling | Jacobian H of h | cross-covariance of sigma points (no H) |
| Gain & correct | standard Kalman update | standard Kalman update |
| Calculus required | Jacobians F and H, derived by hand | none — only function evaluations |
Read the bottom row again: the U-K-F replaces every Jacobian with sigma-point evaluations. You hand it the motion model f and the sensor model h as ordinary functions — "give me a state, I'll give you the next state / the expected measurement" — and the filter never asks for a derivative. Swapping in a new sensor means writing one new h function; in the E-K-F it also means deriving and debugging a new Jacobian matrix.
Below, a 2-D state (the dot) is tracked through one U-K-F cycle. Step through it: the sigma points spread out from the current belief, get pushed forward by the motion model (predict), then a noisy measurement arrives and the belief is pulled toward it by the Kalman gain (update). The covariance ellipse grows on predict (more unsure) and shrinks on update (the measurement sharpened us). This is the entire loop, one click at a time.
Press Step to advance: 1) spread the sigma points from the belief, 2) push them through the motion model (the ellipse grows — predict), 3) a measurement arrives, 4) the belief snaps toward it and the ellipse shrinks (update). The truth is the dashed dot. Run auto-cycles.
This is the payoff. Everything from the last six chapters — the cloud, the sigma points, the push through the true curve, the recovered mean, and the contrast with the E-K-F's tangent line — running together in one panel you can break. Drag the nonlinearity, fatten the uncertainty, and watch the U-K-F's win grow exactly where the theory said it would.
Here's the setup. A Gaussian blob of uncertainty sits on the input axis. A nonlinear function (whose curvature you control) bends it as it passes through. We draw, on the output side: the true warped cloud (a dense scatter, the ground truth), its true mean, the U-K-F's recovered mean from just the sigma points, and the E-K-F's tangent-line mean. The numbers update live. The whole lesson is in the gap between the green/orange marks (which track each other) and the red mark (which drifts off as you bend the curve).
An input Gaussian (left/bottom) is pushed through a curved function (drawn diagonally). On the output, compare the true mean, the U-K-F mean (from 3 sigma points, shown as rings), and the E-K-F mean (tangent line). Curvature bends the function; Uncertainty fattens the blob. Watch the U-K-F hug the truth while the E-K-F drifts — and watch the gap grow with both sliders.
Don't just watch; falsify. Run this sequence and confirm each prediction:
The crucial contrast is experiments 2 and 4 against each other. Same sharp curve, opposite outcomes — because the E-K-F's error isn't about the curve alone, it's about how much of the curve your uncertainty samples. The U-K-F is robust to both because it samples the true curve at the actual edges of your spread, wherever they are. The E-K-F bets your uncertainty stays small; the U-K-F doesn't have to bet.
The sim showed the gap grow as you fattened the blob. Let's make that a curve. Sweep the input spread σ from tiny to wide, push N(2, σ²) through y=x² with each method, and plot the mean error against the true E[x²]=μ²+σ². You'll see the exact shape Chapter 0 promised: the E-K-F error climbing as σ² while the U-K-F line hugs zero.
Every lesson in this series ends with the same four chapters — Use Cases, Practical Application, Debugging, Connections — because a method you can't point at in a shipped system is a method you don't really own. So before any more theory, let's ground the U-K-F in real hardware. The pattern to watch for: the U-K-F shows up exactly where the nonlinearity is sharp, the uncertainty is large, or the Jacobian is a nightmare to derive — the three conditions where the E-K-F's tangent line hurts most.
Spacecraft & satellite attitude estimation. A spacecraft estimates which way it's pointing by fusing gyroscopes (which drift) with star trackers and sun sensors (absolute, but reading angles). Attitude is expressed in quaternions or rotation matrices, and the maps from "orientation" to "what the star tracker sees" are deeply trigonometric — sines and cosines everywhere, with tight accuracy demands (a fraction of a degree). The Jacobians are miserable to derive correctly, and a small bias points the high-gain antenna at empty space. The Unscented Kalman Filter for spacecraft attitude is a textbook application precisely because it sidesteps the quaternion Jacobians and captures the curvature the E-K-F would bias.
GPS / INS integration with strong nonlinearity. Fusing GPS (absolute position from satellite ranges — a curved distance map) with an inertial navigation system (the IMU's accelerations and rotations) is the canonical navigation problem. When the dynamics are gentle the E-K-F suffices, but during aggressive maneuvers, large initial uncertainty (a "cold start" with no good prior), or long GPS outages where the IMU's covariance balloons, the linearization bias bites — and the U-K-F's curvature-aware transform keeps the fused estimate honest where the tangent line would drift.
Robotics: bearing-only and range-only SLAM. A robot that sees landmarks only as angles (a single camera) or only as distances (a sonar ring) is fusing through atan2 and square roots — among the most curved functions in robotics, and with notoriously fat uncertainty before the landmark is well-triangulated. This is exactly the "sharp curve + wide cloud = big bias" regime from Chapter 0, and it's where the U-K-F (and its cousins) routinely replace the E-K-F for localization and mapping.
Battery state-of-charge & process estimation. Far from robotics, the U-K-F is a staple of battery management systems. A lithium battery's voltage relates to its state-of-charge through a steeply nonlinear curve, and you can't measure charge directly — you infer it by fusing current and voltage through that curve. The U-K-F estimates "how full is this battery" in your phone and EV. Chemical-process and power-system estimation lean on it for the same reason: the models bend hard and the Jacobians are ugly.
Notice the recurring reason engineers reach for the U-K-F over the simpler E-K-F:
| System | Nonlinear map being fused through | Why U-K-F over E-K-F |
|---|---|---|
| Spacecraft attitude | orientation → star/sun-sensor angles (trig) | brutal quaternion Jacobians; tight accuracy |
| GPS / INS navigation | position → satellite ranges (√) | large uncertainty during outages / cold start |
| Bearing-only SLAM | landmark → angle (atan2) | extreme curvature + fat prior uncertainty |
| Battery state-of-charge | charge → terminal voltage (steep curve) | sharp nonlinearity, no direct measurement |
| Target tracking (radar) | position → range/bearing/Doppler | polar-to-Cartesian curvature, big initial cov. |
The attitude problem is worth a closer look because it concentrates every reason the U-K-F exists. A spacecraft's orientation lives on a curved space (the set of rotations — not a flat vector space), and the gyros measure angular rate while the star tracker measures the direction of known stars. To fuse them, you map "current orientation" to "expected star directions," and that map is a stack of trigonometric functions. Three things make the E-K-F painful here, and the U-K-F fixes all three at once:
This is why "UKF for spacecraft attitude estimation" is a phrase you'll see across the aerospace literature, and why the original Julier–Uhlmann motivation came partly from navigation and tracking problems where the E-K-F's linearization had been quietly costing accuracy for decades.
You can now diagnose whether a system should be using a U-K-F from its description. Three tells:
When all three appear together — curved maps, wide uncertainty, ugly Jacobians — the U-K-F is almost certainly the right tool, and many shipped systems quietly switched to it for exactly that combination.
You know the U-K-F's machinery. Now the engineer's question: how do you actually set it up, and when do you reach for it over the simpler E-K-F? This recurring "now build it" chapter turns the theory into knobs you can turn and a decision you can make.
Back in Chapter 3 we used a single scaling parameter λ and quietly noted it comes from three more fundamental knobs. In the standard "scaled unscented transform," the spread is controlled by three parameters — α (alpha), β (beta), and κ (kappa) — combined into λ = α²(n + κ) − n. You rarely need to think hard about them, because there are well-known sensible defaults, but here's what each one does so you can reason about them:
| Param | Controls | Intuition | Typical value |
|---|---|---|---|
| α (alpha) | how far the sigma points spread from the mean | small α → points hug the mean (safer for very local nonlinearity); large α → points reach far out | small, e.g. 1e−3 to 1 |
| κ (kappa) | secondary spread / scaling | often set to 0, or to 3−n to match a Gaussian's fourth moment | 0 (or 3−n) |
| β (beta) | incorporates prior knowledge of the distribution's shape into the covariance weights | for a Gaussian, β = 2 is optimal | 2 (Gaussian) |
The practical truth: start with α small (1e−3), β = 2, κ = 0, and only touch α if the filter misbehaves. The vast majority of U-K-F deployments never tune beyond these defaults. If you find yourself agonizing over α, β, κ, you're probably over-thinking it — the parameters are a fine-tuning luxury, not a setup chore.
The two filters solve the same problem (nonlinear fusion); the choice is about which costs you're willing to pay. Run these questions:
The U-K-F isn't free. Where the E-K-F evaluates each model once (at the center) per step, the U-K-F evaluates it 2n+1 times (once per sigma point), and it computes a matrix square root of the covariance each step to place the points. For a small state (n = 3, so 7 points) this is trivial. For a large state (n = 30, so 61 points) the per-step cost is noticeably higher than the E-K-F's, though both are still far cheaper than a particle filter's thousands of samples.
| Cost axis | E-K-F | U-K-F |
|---|---|---|
| Model evaluations / step | 1 (at the center) | 2n+1 (one per sigma point) |
| Matrix square root / step | no | yes (to place the points) |
| Hand-derived Jacobians | yes — the development cost | none |
| Accuracy on curves | first order | second / third order |
Concrete example. You're tracking a target's 2-D position (n = 2, so 5 sigma points) from a sensor that reports only the bearing (angle) to it — an atan2, sharply curved. Walk the decision: Q1 nonlinear? Yes (atan2). Q2 sharp nonlinearity / large uncertainty? Both — atan2 is vicious and before triangulation the position uncertainty is wide. Q3 Jacobian painful? The bearing Jacobian is derivable but a classic place for sign errors. All three point to the U-K-F. Setup: state dimension n = 2, defaults α = 1e−3, β = 2, κ = 0, the sensor model h(x) = atan2(x_y − sensor_y, x_x − sensor_x) coded as a plain function, and you're done — no derivative anywhere. The filter pushes its 5 sigma points through that atan2 each update and reads off the bearing's predicted mean and spread.
The U-K-F is not magic; it has its own characteristic failures, and they're different from the E-K-F's. Knowing them is the difference between a filter you trust and one that diverges in the field at the worst moment. This recurring chapter catalogs the classic traps, the symptom each shows, and the specific test that exposes it.
The U-K-F places its sigma points using a matrix square root of the covariance P. That operation only works if P is positive definite — intuitively, a "valid" spread with positive variance in every direction. But across many steps, numerical round-off, an overconfident measurement, or a too-aggressive parameter can nudge P into a state where it's no longer positive definite (a "negative variance" in some direction, which is physically nonsense). The square root then fails — the filter throws a math error or, worse, produces NaNs and silently corrupts every estimate downstream.
NaNs or crashes in the square-root call, often right after a surprising measurement or a long prediction. Detection: check P's eigenvalues (or just attempt a Cholesky factorization) each step — if any eigenvalue goes negative (or Cholesky fails), P has lost positive-definiteness. Fix: the square-root U-K-F (SR-U-K-F), a numerically robust variant that propagates the square root of the covariance directly (never reconstructing P), so it's structurally guaranteed to stay positive definite. If you see covariance crashes, switching to the SR-U-K-F is the standard cure.Recall from Chapter 3 that the center weight can go negative for high-dimensional states with certain parameter choices. A negative weight on the covariance recombination can, in pathological cases, produce a covariance that isn't positive semi-definite even before round-off — feeding straight into Trap 1. More subtly, a poorly chosen λ (from extreme α, κ) can place the sigma points absurdly far out, sampling the function in regions of near-zero probability and producing a garbage mean.
The opposite mistake: reaching for the U-K-F when the problem doesn't need it. If your models are nearly linear and your uncertainty is small, the E-K-F's tangent line is already accurate — and the U-K-F buys you nothing for its extra cost (2n+1 evaluations, a square root each step). You've paid more runtime for identical accuracy.
Here's the diagnostic that decides whether you even need a U-K-F. Push your real prior through your real sensor model both ways and tabulate. Example for a range sensor h(x) = √(x²) on a 1-D state, true output mean computed by dense sampling:
| Your prior uncertainty | True output mean | E-K-F mean | U-K-F mean | Reading |
|---|---|---|---|---|
| small (σ tiny) | 10.00 | 10.00 | 10.00 | all agree → E-K-F is fine, U-K-F is overkill |
| medium | 10.30 | 10.05 | 10.28 | E-K-F starting to bias; U-K-F close |
| large (σ wide) | 11.20 | 10.10 | 11.15 | E-K-F badly biased → U-K-F clearly worth it |
The table tells you the answer mechanically: run it at your operating uncertainty. If the E-K-F column tracks the truth, save the cycles. If it drifts (bottom row), the U-K-F is earning its keep and you should switch. Don't guess whether you need a U-K-F — measure the bias at your real uncertainty.
The sigma-point count is 2n+1, growing linearly with state dimension. For a 60-state system that's 121 evaluations of your (possibly expensive) models every step. If your model evaluation is heavy — a complex dynamics simulation, a ray-cast, a learned network — the U-K-F's per-step cost can become the bottleneck, surprising teams who profiled on a small toy state.
| Check | How | Catches |
|---|---|---|
| Covariance stays valid? | Cholesky / eigenvalues of P each step | Trap 1 (non-PD covariance → SR-U-K-F) |
| Weights sane? | Print weights (mean weights sum to 1); print sigma-point locations | Trap 2 (bad weights / exotic λ) |
| Is the bias even there? | Push your prior through h both ways; compare to dense-sample truth | Trap 3 (U-K-F overkill on near-linear) |
| Real-time at full dimension? | Count 2n+1 evals × model cost; profile at real n | Trap 4 (cost creep) |
| Innovation reasonable? | Watch the innovation (z − predicted z); should be small & zero-mean | divergence / model mismatch (shared with all KFs) |
You can now fuse through a nonlinearity without ever drawing a tangent line or deriving a Jacobian. Before we point to what's next, here's everything in one place — the cheat-sheet to screenshot, the motto, the real sources, and the cross-links.
Screenshot this. It is the entire lesson collapsed into a single lookup:
| E-K-F | U-K-F | |
|---|---|---|
| Approximates the… | function (tangent line) | distribution (sigma points) |
| Needs Jacobians? | yes (hand-derived) | no (function evals only) |
| Mean accuracy | first order | second / third order |
| Cost per step | 1 evaluation | 2n+1 evaluations + a square root |
| Best when… | gentle curve, small uncertainty | sharp curve, large uncertainty, ugly Jacobian |
| y=x² on N(2,4) | 4 (true is 8) | 8 (exact) |
This was Lesson 8 of 22. The arc so far: the plain Kalman filter (optimal, but linear-only) → the E-K-F (linearize with a tangent line) → the U-K-F (sigma points, no linearization). Each step handles a harder reality. But the U-K-F still assumes the belief is a Gaussian — a single bell-shaped cloud. The next lesson breaks even that assumption.
| Lessons | Arc | What you build on top |
|---|---|---|
| 4–5 | Probabilistic foundations | the Bayes filter; the Kalman filter (optimal linear fusion) |
| 6–8 | Nonlinear estimation | nonlinear models; the E-K-F (tangent line); the U-K-F (sigma points — here) |
| 9–10 | Beyond Gaussian | the particle filter (clouds of samples, any distribution); multi-hypothesis tracking |
| 11–18 | Spatial & robust fusion | SLAM; visual-inertial odometry; fault detection; covariance intersection |
| 19–22 | Modern / learned | deep fusion; transformer multimodal fusion; the Sensor Fusion Atlas |
Next up, Lesson 9: The Particle Filter — what if your belief isn't a single bell curve at all? What if you're not sure whether the robot is in the kitchen or the hallway — two separate possibilities, a distribution with two humps that no Gaussian (and so neither the E-K-F nor the U-K-F) can represent? The particle filter throws out the Gaussian entirely and tracks a swarm of thousands of weighted samples that can take any shape. The U-K-F's "a few clever points carry the cloud" becomes "many random points are the cloud." It's the most flexible filter of all — and the most expensive.
These existing lessons go deeper on the machinery around the U-K-F: