GPS Positioning: Geometry and DOP#

This demo solves the GPS positioning problem from raw pseudorange measurements on a 2D toy constellation. It is a black-box receiver model: given \(N\) pseudoranges from satellites at known positions, run a Gauss-Newton nonlinear least-squares fit and report the receiver position estimate plus a single uncertainty number (HDOP). No prior, no IMU, no Kalman filter. This is the architecture of every standalone GPS receiver and the framing that Block 7 will later refine into a properly Kalman-fused (tightly coupled) solution.

The headline lesson is that geometry, not noise, controls accuracy. Two scenarios with the same number of satellites and the same per-pseudorange noise can produce position accuracy that differs by an order of magnitude or more, purely because the satellites are arranged differently in the sky. The demo lets you drag satellites around the orbit and watch the position uncertainty inflate or collapse in real time.

The math#

Each satellite contributes one pseudorange equation:

\[ \tilde{\rho}_i = \underbrace{\lVert \mathbf{r}_u - \mathbf{r}^{(i)} \rVert}_{\text{true range}} + b + \epsilon_i, \]

where \(\mathbf{r}_u = (p_x, p_y)\) is the receiver position, \(\mathbf{r}^{(i)}\) is the \(i\)-th satellite position, \(b\) is the unknown receiver clock bias (in meters of equivalent range), and \(\epsilon_i \sim \mathcal{N}(0, \sigma_\rho^2)\) is independent measurement noise. With three or more satellites in 2D (four or more in 3D) the system can be solved: exactly three is exactly determined, and more than three over-determines it. Either way we solve nonlinear least squares for the unknowns \(\boldsymbol{\beta} = [p_x, p_y, b]^{\top}\):

\[ \hat{\boldsymbol{\beta}} = \arg\min_{\boldsymbol{\beta}} \sum_i \left( \tilde{\rho}_i - h_i(\boldsymbol{\beta}) \right)^2, \qquad h_i(\boldsymbol{\beta}) = \lVert \mathbf{r}_u - \mathbf{r}^{(i)} \rVert + b. \]

The function \(h_i\) is nonlinear in position because of the Euclidean norm; this is what makes GPS a nonlinear estimation problem in the first place. The demo solves it iteratively with Gauss-Newton: linearize \(h_i\) around the current estimate, take a step, repeat until convergence.

After convergence, the position covariance follows from the linearized Jacobian \(\mathbf{H}\):

\[ \mathbf{P}_{\text{pos}} = \sigma_\rho^2 (\mathbf{H}^{\top}\mathbf{H})^{-1}\bigg|_{\text{position block}}, \qquad \mathrm{HDOP} = \frac{\sqrt{\mathrm{tr}(\mathbf{P}_{\text{pos}})}}{\sigma_\rho} = \sqrt{[(\mathbf{H}^{\top}\mathbf{H})^{-1}]_{11} + [(\mathbf{H}^{\top}\mathbf{H})^{-1}]_{22}}. \]

HDOP depends only on the satellite directions, not on the noise (strictly, the directions seen from the true position; the demo evaluates them at the estimate, which adds a small wobble on its 20 km toy orbit, see step 7). Receiver hardware controls \(\sigma_\rho\). The constellation controls HDOP. The product \(\sigma_{\text{pos}} = \mathrm{HDOP} \times \sigma_\rho\) is the operationally useful decomposition.

Interactive demo#

Open in full screen

The demo has two coupled views. The constellation overview (left) shows the satellites on their orbit, each in its own color, with lines of sight to the receiver and the solver’s iterates (orange) walking in from a starting guess 1.8 km off. Drag a satellite around the orbit to change the geometry, or Tab to it and use the arrow keys (5° per press). The receiver-area zoom (right) shows the same scenario at meter scale: each satellite’s ±1σρ pseudorange band, in that satellite’s color with a thin center line, drawn perpendicular to its line of sight. Where the bands intersect is where the receiver could be. The red dashed 95% covariance ellipse summarizes the analytical uncertainty, the dotted gray circle at the truth is the 95% circle HDOP = 1 would give at the same \(\sigma_\rho\), and a scale bar sits in the bottom-left corner. The trial clock bias slider holds \(b\) at \(\hat{b} + k\,\sigma_b\) (\(k\) from −3 to +3): every band shifts by that amount, and a hollow diamond marks the best-fit position with \(b\) held there. The position-error card turns orange when the estimate lands outside its own 95% ellipse (\(\mathbf{e}^{\top}\mathbf{P}^{-1}\mathbf{e} > 5.99\)), and a cue line under the controls says what to notice.

A note on the bands: each one represents “constant distance from a single satellite”; at the receiver-area scale, that’s a tangent line to the (very large) range circle, oriented perpendicular to the satellite’s line of sight. The band is not a ray pointing at the satellite. The same way an isobar runs perpendicular to the pressure gradient, a pseudorange band runs perpendicular to the radial direction.

Walkthrough#

The demo opens at the Even spread preset: 4 satellites at 90° intervals on a 20 km orbit, \(\sigma_\rho = 3\) m, true clock bias \(b = 17\) m. Try the following:

  1. Read the headline metrics. HDOP = 1.00 (0.71 if you raise the satellite count to 8), so \(\sigma_\text{pos} = 3.0\) m. This noise draw lands 4.7 m from truth, inside the 95% ellipse, and \(\hat{b} = 19.71\) m, 2.7 m from truth (\(\sigma_b = 1.5\) m). Gauss-Newton converges in 4 iterations; the orange path in the overview shows them. The bands cross at right angles in the zoom view, and the 95% ellipse is a circle of radius 5.2 m, the same size as the dotted HDOP = 1 circle. This is what good geometry looks like.

  2. Click “Clustered (bad).” All four satellites snap into a 30° arc (60° to 90°) at the upper-right of the orbit. HDOP jumps to 32.9 (red on the stat card) and \(\sigma_\text{pos}\) to 99 m. The zoom view rescales from ±8.3 m to ±385 m, and the HDOP = 1 circle shrinks to a dot at the truth. The ellipse balloons to semi-axes of 241 m × 19 m, its long axis at 75°, along the line of sight toward the middle of the cluster. The estimate misses by 76 m and \(\hat{b}\) by 75 m, both inside their 95% bounds. Same noise, same number of satellites, 33× worse precision, purely from geometry.

  3. Notice the ellipse orientation. The major axis of the bad-geometry ellipse points along the cluster’s LoS, not perpendicular to it. This is the clock-bias coupling: when satellites are clustered, shifting the estimated clock bias \(\hat{b}\) shifts every pseudorange band by nearly the same amount in nearly the same direction (the cluster LoS), creating a near-rank-1 ambiguity in the joint \((p_x, p_y, b)\) solve. The position uncertainty inherits that ambiguity. To see it, move the trial clock bias slider to +2. Every band shifts 193 m (\(2\sigma_b\)) toward its satellite, the bands still nearly meet, and the hollow diamond (the best fit with \(b\) held there) slides 197 m along the long axis: \(b\) and position are correlated at \(r = 1.00\). Do the same at Even spread: the diamond does not move (\(r = 0.00\)) and the bands visibly stop meeting at a point, because spread geometry pins \(b\) down.

  4. Drag one satellite out of the cluster. At Clustered, take satellite 4 (the top one, at 90°) and drag it around to the lower-left, or Tab to it and hold an arrow key. HDOP falls from 32.9 to 4.26 at 220° and bottoms out at 4.11 near 250°, opposite the middle of the cluster. Pulling out an inner satellite instead (satellite 2, at 70°) gets to 2.74, because the three left behind still span the full 30°. Adding satellites inside the arc barely helps: Clustered with 7 satellites is still HDOP 28.4. One satellite at a different angle is worth more than three more at the cluster’s angle. This is why GPS receivers prefer constellations spread across the sky. Elevation masks pull the other way: dropping low-elevation satellites usually raises DOP, and receivers accept that cost to reject the multipath and atmospheric error those low satellites carry.

  5. Try “Half sky.” Satellites span a semicircle (0° to 180°). HDOP = 1.32: markedly better than clustered, slightly worse than the full spread. The ellipse (semi-axes 8.5 m × 4.6 m) stretches along the vertical, the axis that points into the empty half of the sky, where no satellite constrains it. This is a realistic scenario in canyons, near tall buildings, or with one of multiple constellations occluded.

  6. Slide the true clock bias anywhere in \([-50, +50]\) m. \(\hat{b}\) moves one-for-one with it, and nothing else changes: HDOP, \(\sigma_\text{pos}\), the position error and the clock-bias error stay put (the last is 2.7 m at Even spread, 75 m at Clustered). Clock bias is a fourth (here third, because we’re in 2D) unknown, and its value costs nothing: the solver absorbs any \(b\) exactly, without degrading the geometry. That’s the whole point of inverting for it as part of the LS fit rather than trying to know it ahead of time. What carrying it as an unknown does cost is one extra satellite and, under clustered geometry, the \(b\)-position coupling of step 3.

  7. Slide \(\sigma_\rho\) up or down while leaving the geometry fixed. At Even spread HDOP stays 1.00 and the 95% ellipse radius scales exactly with \(\sigma_\rho\): 0.9 m, 5.2 m and 35 m at \(\sigma_\rho\) = 0.5, 3 and 20 m, per \(\sigma_{\text{pos}} = \mathrm{HDOP} \times \sigma_\rho\). At Clustered HDOP drifts a little (33.10, 32.90, 31.60) because \(\mathbf{H}\) is evaluated at the estimate, which lands farther from truth as \(\sigma_\rho\) grows (495 m at 20 m). On this 20 km toy orbit that tilts the lines of sight slightly; on a real GPS orbit the effect is negligible. Receiver-side improvements (better antennas, multi-frequency, code-phase tracking) attack \(\sigma_\rho\). Constellation-side improvements (multi-GNSS, optimized satellite scheduling) attack HDOP. They multiply.

  8. Reseed. New noise realization, same geometry. The estimate jumps around, inside the ellipse about 95% of the time (the error card turns orange when it lands outside). The ellipse itself does not change at Even spread (HDOP 1.00 every time) and barely changes at Clustered (32.9 to 33.7 over eight reseeds, for the reason in step 7). The ellipse is a property of the geometry; the dot inside it is a single noisy realization.

Key observations#

  • GPS positioning is a nonlinear least-squares problem. Pseudorange is nonlinear in user position because of the Euclidean norm. The receiver runs Gauss-Newton (or an equivalent iterative method), not a closed-form formula.

  • The clock bias is just another unknown. Treating \(b\) as a state variable rather than trying to know it ahead of time is what makes GPS practical. The cost is requiring one extra satellite (3 in 2D, 4 in 3D); the benefit is robustness to receiver clocks that are millions of times less stable than satellite clocks.

  • Each pseudorange constrains the receiver to a circle, not a ray. The band drawn at the receiver scale is a tangent line to that circle, perpendicular to the line-of-sight. Bands tell you about radial distance to a satellite, not direction to it.

  • Geometry is the dominant lever for accuracy. In this demo a 30° cluster of four satellites gives HDOP 32.9 against 1.00 for the even spread: 33× worse position precision with the same hardware and the same pseudorange noise. The numbers behind the rule of thumb HDOP < 2 (good) versus HDOP > 5 (degraded) come directly from this geometry.

  • The clock-bias-induced ambiguity dominates the ellipse shape under bad geometry. With clustered satellites, the dominant ambiguity is along the cluster’s line-of-sight (because that’s the direction along which a \(\Delta b\) shift maps to a position shift in (px, py)). Spread the satellites and the rank-1 ambiguity disappears.

From “black-box” to fused#

This demo treats the receiver as a self-contained box: pseudoranges in, position estimate out, no other inputs. That is the loose-coupling architecture, where a navigation filter consumes the receiver’s position estimate as if it were any other position sensor (this is exactly what the 4D Kalman filter from Block 5 did). It is simple and works fine when the receiver always has good geometry and clean signals.

When that breaks down (bad geometry, multipath, occlusion, jamming), a tightly-coupled architecture wins. Tightly-coupled means feeding the raw pseudoranges into a Kalman filter alongside the IMU mechanization, letting the filter weigh each pseudorange by its individual variance and ride through brief outages. Block 7 builds exactly that: an EKF whose measurement model linearizes the same nonlinear \(h_i\) used here, but at every step rather than only at convergence of a single batch.

Source#

The MATLAB companion solves the same scenario (receiver at the origin, \(b = 17\) m, \(\sigma_\rho = 3\) m, four satellites on a 20 km orbit, the same 1.8 km initial guess) for the Even spread and Clustered geometries with fitnlm, from its own noise draw (rng(7)). It prints HDOP 1.00 and 33.16 (the demo’s draw gives 32.90; step 7 explains the small difference) and a bad-geometry 95% ellipse with semi-axes 242.8 m × 19.0 m, major axis at 75.0°. Like the demo, it forms the covariance as \(\sigma_\rho^2(\mathbf{H}^{\top}\mathbf{H})^{-1}\) at the solution, not from fitnlm’s CoefficientCovariance, which rescales by the residual variance; with only one spare measurement that would make HDOP itself a noisy number.

MATLAB bundle · demos/GPSPositioningDemo.m↓