Introduction

The Global Positioning System (GPS) is one of the most widely used technologies in modern life, powering everything from smartphone navigation to autonomous vehicles. At its core, GPS determines your position by measuring the time it takes for signals to travel from satellites to your receiver. This process, often called "trilateration" (not triangulation, as angles aren't involved), relies on precise timing and signal processing.

The Basic Principle: Time of Flight

GPS satellites orbit Earth at approximately 20,200 km altitude, completing two orbits per day. Each satellite continuously broadcasts radio signals containing two critical pieces of information:

  1. The satellite's precise position (ephemeris data)
  2. The exact time the signal was transmitted (based on atomic clocks)

When your GPS receiver picks up these signals, it measures the time difference between when the signal was sent and when it was received. Since radio waves travel at the speed of light (approximately 299,792 km/s), this time difference directly translates to distance:

d=cΔtd = c \cdot \Delta t

where cc is the speed of light and Δt\Delta t is the measured time delay.

Why Four Satellites?

You might think three satellites would be enough to determine position in 3D space (latitude, longitude, altitude). However, GPS requires at least four satellites. Here's why:

Each satellite signal gives you a "sphere of possible positions" - you know you're somewhere on a sphere with radius equal to the measured distance from that satellite. With three satellites, these spheres intersect at two points, but one is typically far from Earth's surface and can be eliminated.

The fourth satellite is needed because your GPS receiver doesn't have an atomic clock. There's an unknown time offset in your receiver's clock, which introduces an error in all distance measurements. The fourth satellite provides the additional equation needed to solve for four unknowns: x, y, z position, and the clock bias.

The Signal Structure

GPS satellites transmit on two primary frequencies:

  • L1 band: 1575.42 MHz (civilian use)
  • L2 band: 1227.60 MHz (military and advanced civilian applications)

Each satellite uses a unique pseudorandom noise (PRN) code that allows receivers to distinguish between satellites. The L1 signal contains:

  • C/A Code (Coarse/Acquisition): A 1.023 MHz code that repeats every millisecond
  • Navigation message: Transmitted at 50 bits per second, containing ephemeris data, satellite health, and clock corrections

From Signals to Position: The Math

The basic positioning equation for each satellite ii is:

ρi=(xxi)2+(yyi)2+(zzi)2+cb\rho_i = \sqrt{(x - x_i)^2 + (y - y_i)^2 + (z - z_i)^2} + c \cdot b

where:

  • (x,y,z)(x, y, z) is the unknown receiver position
  • (xi,yi,zi)(x_i, y_i, z_i) is the known position of satellite ii
  • cc is the speed of light
  • bb is the receiver clock bias
  • ρi\rho_i is the measured pseudorange to satellite ii

With four or more satellites, we have a system of nonlinear equations that can be solved for the four unknowns (x,y,z,b)(x, y, z, b).

Sources of Error

Real-world GPS signals face several error sources:

  1. Atmospheric delays: Ionosphere and troposphere slow signal propagation
  2. Multipath: Signals bouncing off buildings or terrain
  3. Satellite clock errors: Despite atomic clocks, small errors exist
  4. Orbital errors: Satellite positions aren't perfectly known
  5. Receiver noise: Electronic noise in the GPS receiver

These errors can accumulate to 5-10 meters of position uncertainty in civilian GPS.

Advanced Signal Processing

To improve accuracy, modern GPS receivers use sophisticated filtering techniques that combine multiple position measurements over time. Two common approaches are:

Nonlinear Least Squares (NLS)

NLS iteratively refines the position estimate by minimizing the squared difference between measured and predicted pseudoranges. Starting with an initial guess, the algorithm uses the Gauss-Newton method to find the position that best fits all satellite measurements.

Extended Kalman Filter (EKF)

The EKF treats GPS positioning as a dynamic state estimation problem. It maintains a statistical model of both position and uncertainty, predicting future positions based on motion models and updating estimates as new satellite measurements arrive. This is particularly effective for moving receivers, as it can filter out noise while preserving real motion.

Next Steps

In the following sections, I'll demonstrate these filtering techniques with actual code and visualizations, showing how they improve GPS accuracy by processing noisy satellite signals into reliable position estimates.