Samples and IQ
This chapter makes the numbers concrete. By the end you can take two numbers from a stream, work out the strength of the signal they came from with a pencil, and say why the stream carries pairs of numbers in the first place. No algebra beyond squares and a square root, and every number here can be checked by hand.
One number at a time: real samples
Stand in one place and write down the height of a wave once every second. The list of heights is a sampled signal, and each height is a sample. Sample a pure tone — one steady note — and the list repeats in a pattern. Eight samples of one full cycle of a wave might read:
0, 7, 10, 7, 0, -7, -10, -7, 0, 7, 10, ...
The wave rose, peaked, fell through zero, dipped, and came back. Given enough samples per cycle, the list is the wave, for any practical purpose: a computer can rebuild the tone from the list and play it back, indistinguishable from the original. That is the first fact everything here stands on. A stream of numbers, taken fast enough, captures a wave completely.
The catch hides in "fast enough", which is chapter 3's whole subject. This chapter is about the second catch: one number at a time is not always enough.
Why pairs: the problem with one number
Watch the list above at the moment the wave crosses zero going up: the sample reads 0. A moment later the wave crosses zero going down: the sample also reads 0. A single number cannot tell you which way the wave was travelling, or — the same problem stated differently — it cannot tell a wave at one frequency from its mirror image at a negative frequency. For sound, nobody cares. For radio, where the interesting question is often "exactly which frequency, and is it above or below my tuning point", the ambiguity is fatal.
The fix is to take two measurements
at each instant, arranged so that
together they pin the wave down. The
second measurement is the same wave read
through a device that delays it by a
quarter of a cycle. The pair is written
(I, Q): I is the in-phase
number, the plain measurement; Q is
the quadrature number, the
quarter-cycle-shifted one. A stream of
such pairs is a complex stream — the
word is bookkeeping, not a warning about
difficulty. GNU Radio calls the pair a
complex number and writes it I + jQ.
The arrow picture, and arithmetic you can check
Draw the pair as an arrow on graph paper. I is how far the arrow points right; Q is how far it points up. As the wave runs, the arrow rotates, one full turn per cycle — anticlockwise for a signal above the tuning point, clockwise for one below it, which is exactly the distinction one number could not make.
Two facts about the arrow do nearly all the work in this guide:
- Length is strength. The arrow's length is the signal's size at that instant, and Pythagoras prices it: length = √(I² + Q²). Check it with the friendliest triangle in the world: I = 3, Q = 4. Then I² + Q² = 9 + 16 = 25, and √25 = 5. If a flowgraph hands you (3, 4), it is handing you a signal of strength 5, pointing up and to the right.
- Speed of turning is frequency. An arrow that turns once while 8 samples pass is a signal whose frequency is one eighth of the sample rate. An arrow standing still is a signal exactly on the tuning point — frequency zero, a steady pair of numbers. Chapter 11's receiver works by slowing a station's arrow to a standstill and then reading its length wobble as sound.
Check your understanding: given the pair I = 6, Q = 8, the strength is √(36 + 64) = √100 = 10. An arrow turning once every 4 samples is at a quarter of the sample rate. If you can do those two sums, you have all the mathematics chapters 6 to 12 will ask of you. Next, chapter 3: how fast the samples must come, and what goes wrong — honestly and visibly wrong — when they come too slowly.