# Satellites, Files and Steps

Class 11, Chapter 6: GPS Watches and Motion Sensors. 28 slides, about 35.5 minutes.

## 1. Title

Slide up while people sit down. A watch draws a map and prints a distance to two decimals. Today we take every number on that screen apart: where it comes from, what was measured, what was computed, and how wrong it can be. Then you go to a track and check your own watch.

## 2. Four ranges, four unknowns  (2 min)

A navigation satellite carries an atomic clock and broadcasts the time and its own position. Your watch hears it a little late, and the delay times the speed of light is the distance to that satellite. Three ranges would fix your position if the watch's clock were perfect. It is not: one microsecond of error is three hundred metres. So the receiver treats its clock error as a fourth unknown and uses a fourth satellite. What spoils a fix? A narrow sky between buildings, signals bouncing off walls, wet leaves, your own arm, and the filter that expects you to keep going straight at a corner.

## 3. The receiver measures time  (1 min)

One sentence to keep. The receiver measures time; everything else on the screen is computed, and every step adds error. There is one shortcut worth knowing. The satellite signal shifts in frequency as you move toward or away from it, like a passing siren, and the receiver can solve for your velocity directly from that shift. On a straight path that Doppler speed tracked true speed better than speed from successive positions, with ninety percent of values within a tenth of a metre a second. Positions still give the map and the distance.

## 4. The distance between two fixes  (2 min)

A watch stores each fix as a latitude and a longitude. The haversine formula gives the distance between two of them along the Earth's surface. Check it by hand on an easy case: one ten-thousandth of a degree of latitude is eleven point one metres. A degree of latitude is a hundred and eleven kilometres everywhere. A degree of longitude shrinks with the cosine of latitude: at forty degrees, eighty-five kilometres. Over the few metres between fixes, a flat map is exact enough, and that is how your build step will draw a route. The most common mistake is to forget the cosine. Hold that thought.

## 5. Check the AI: a route that runs long  (2 min)

Here is that mistake, made by an AI assistant. It treats a degree of longitude as if it were a degree of latitude, a hundred and eleven kilometres. [Give them a minute to compute.] North leg: eleven hundred and twelve metres, right. East leg: the code also says eleven twelve, but at forty degrees it is eight fifty-two. Total twenty-two twenty-four instead of nineteen sixty-four, thirteen percent long. On an east-west route it would be thirty percent long. Nothing crashes, and a route on a map just looks stretched. The fix is one cosine, and the test is a known answer from Exercise six five.

## 6. The same 3 m error, twice  (2.5 min)

Two laps of a track, made up so we know the truth. Same runner, same three-metre position errors. On the left the errors are independent from one second to the next; on the right they wander slowly. [Ask: how long is each lap if you join the fixes?] [Click.] Seven hundred forty-four metres on the left: the zigzag adds length, because errors do not cancel when you add up straight lines. Four hundred three on the right: nearly right, but the whole lap is shifted. Real receivers are much nearer the right, because the same satellites and the same filter shape fix after fix. That is why watches give believable distances at all.

## 7. A walk that grew  (2 min)

[Thirty seconds, hands up.] B. Summed distance from noisy fixes runs long, and the bias grows as the true step between fixes shrinks compared with the error. A walker moves about half as far each second as a runner, so the same few metres of error add more. Standing at a traffic light adds distance while you go nowhere. C is the opposite effect: smoothing and once-a-second fixes cut corners, which makes distance short on twisty routes. So summed distance has two biases, long from noise when slow, short from corners when twisty, and the route decides which wins.

## 8. Pace from a real file: resolution and lag  (2 min)

Now a real run, shared by its owner and de-identified. The gray dots are one-second speeds computed from the distance field. They sit on a few levels, because the file stores distance to half a metre, so one-second speed jumps in steps of half a metre a second, fifteen percent of the runner's speed. Averaging over ten seconds, the dashed line, follows the watch's own speed closely, a few seconds late. That is the trade: a short window is fast and noisy, a long one steady and late. For short repeats, run by time and effort, and read the pace afterward.

## 9. Elevation: noise becomes climb  (1.5 min)

Height is the weakest part of a satellite fix, so watches use a barometer: one hectopascal for every eight and a half metres. But a barometer cannot tell height from weather. Then elevation gain adds every rise and ignores every fall, which turns jitter into climb. A flat half hour with half a metre of noise climbs four hundred eighty-one metres if every rise counts, fifteen with a three-metre threshold. The example run: fifty-three, forty-two, and the watch's own forty-eight. Every gain number is a choice of threshold. Compare climb only between files made the same way.

## 10. A zero-length interval: state the rule  (2 min)

A FIT time stamp is a whole second. Press the lap button and the watch can write two records with the same stamp. The time step is zero, and Python does not stop: it returns infinity, and one infinity turns the mean speed of the whole run into infinity. Notice also the false slow second after it, one point seven five, because the extra record stole half the next distance. The listing's rule: drop any record whose time does not increase, keep the first, count them, and assert that time now strictly increases, so a file that breaks the rule another way stops the program loudly.

## 11. Read a FIT file: four facts first  (2.5 min)

An activity file is a table, one record per sample, plus lap and session rows. FIT is the compact binary one most watches write; TCX and GPX are text. Listing six six reads the example run's original FIT file and prints four facts, and each one changes the analysis. The watch was paused for over an hour in the middle, so timer time and elapsed time differ by a factor of three. The laps are miles. The distance is a number the watch computed. And cadence is stored per leg. Positions are stored as semicircles, so forget the conversion and the runner lands thousands of kilometres away.

## 12. A route is personal data  (1.5 min)

A run that starts and ends at the same point usually starts and ends at home. So before you share a route with a teammate, a class or an AI service, apply the book's three steps. Drop every position within five hundred metres of each end. Shift times to start at zero. Add a fixed offset to every longitude, which moves the route and changes no distance, because the haversine depends only on latitudes and differences of longitude. Removing positions is not removing information, though. Share the least you need, and a teammate's route only with their written consent.

## 13. An accelerometer, and steps from it  (2 min)

Inside the watch is a tiny mass on springs. When the housing accelerates, the mass lags and the springs stretch, and the chip measures that along three axes. The catch: on a table it reads one g upward, because the table pushes the mass up just as an upward acceleration would. It measures acceleration minus gravity. Each footstrike is a spike; find the spikes with the same recipe you used for R peaks, and you have steps. Forty-three steps in fifteen seconds is a cadence of one seventy-two. The file stores eighty-six, one leg. And step length is computed: speed divided by cadence.

## 14. Where the sensor sits decides what it can know  (2 min)

A foot sensor feels each contact directly. A lower-back sensor moves with the body's center. A wrist sensor feels the foot only through a swinging arm. The evidence follows that logic: cadence is reliable from many sites, contact time from the foot or lower back, and vertical oscillation from a wrist is a model with little support. Running power in watts is modeled: nothing measures a runner's mechanical power in the field, so each maker chooses a model. Cycling power is different: strain gauges measure torque, times crank speed. Thirty-five newton metres at ninety rpm is three hundred thirty watts, a real measurement.

## 15. The energy cost of running  (1.5 min)

How much energy does a kilometre cost? On level ground, about three point four joules per kilogram per metre, nearly independent of speed: running faster spends energy faster but finishes sooner, and the two cancel. A seventy-kilogram runner covering ten kilometres spends about two point four megajoules, five hundred sixty-nine kilocalories above rest, at any comfortable speed. Hills change that a great deal: more than five times as much on a very steep climb. So holding five minutes a kilometre up a hill is much harder work than on the flat, and slowing on the climb is good pacing.

## 16. Critical speed: a straight line through best efforts  (3 min)

Plot each best effort as distance against time and the points lie close to a line. The slope is critical speed, the highest speed at which the body reaches a steady state. The intercept, D prime, is a fixed distance you can run above it before you must slow. Two trials: twelve hundred metres in four minutes, thirty-six hundred in thirteen twenty. Critical speed four point two nine metres a second, D prime a hundred seventy-one metres. A third trial sits nineteen metres below the line. This is your first linear regression, and it comes with three habits: units on the slope, look at the residuals, and beat a baseline.

## 17. Load over weeks, and a ratio that cannot predict  (2 min)

One run says little; a season is a time series. The Watch dashboard scores each run as minutes times the square of mean over maximum heart rate. Forty minutes at one fifty-two with a maximum of one ninety is twenty-five point six. The acute to chronic ratio divides the last week's daily mean by the last four weeks'. Look at the camp week: one point five six times the weeks before, yet the ratio says one point three seven, because the camp week is itself a quarter of the chronic window. It became popular as an injury warning. A critical review found no evidence for using it that way.

## 18. The instructor's spring, week by week  (2.5 min)

Now the instructor's own watch, nineteen runs this spring, scored with the same rule. Two big weeks in May, eight runs and about eighty kilometres each, after three weeks with nothing in the file. Before you compute a ratio, ask what the empty weeks are. Rest? A different watch? Files that were never exported? A ratio would call May a huge spike, and that might only be missing data. Two more cautions: the maximum here is just the highest value in the set, and the heart rate is optical, at the wrist, with everything Chapter five said about that. Exercise six twenty-five asks you to build this chart.

## 19. Before Class 12  (1.5 min)

Homework twelve is due at the start of next class. The core exercises on distance and pace, then the track check of Exercise six seventeen: ten laps in lane one, a known four thousand metres, so the watch's error is the only error left. Note the sky view, count your steps for thirty seconds on lap five, and give way to faster runners. Then classify walking, jogging and running from a phone accelerometer, and compare with the baseline that always guesses the most common class. Bring your file and a laptop, and read sections six seven to six nine.
