5.5.4 · D2Embedded Systems & Real-Time Software

Visual walkthrough — ADC - DAC — resolution, sampling rate, Nyquist

2,192 words10 min readBack to topic

Before we start, three plain-word promises about the symbols you will meet:

Everything below is built from those three.


Step 1 — What a continuous wave actually is

WHAT. Draw a pure tone. The cleanest wave we can pick is a cosine: it starts at its top, dives to the bottom, and climbs back — forever, smoothly.

WHY a cosine and not something lumpy? Because any signal can be broken into a sum of pure cosines (that is the whole point of the Fourier Transform & Frequency Domain). If we understand what sampling does to one cosine of frequency , we understand what it does to all of them. So we study the simplest brick and trust the wall.

PICTURE. The smooth violet curve is the true signal. Nothing is digital yet — the CPU has not touched it.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

Step 2 — Sampling = stabbing the wave at fixed instants

WHAT. A converter cannot see the whole smooth curve. It only looks at fixed, evenly spaced moments and writes down the height it finds. We space those looks seconds apart.

WHY evenly spaced? Hardware ticks on a clock. A clock is regular by nature, so the looks land at — that is, at for whole numbers

PICTURE. The violet curve is still there, but now only the orange dots survive into the computer. Everything between dots is guessed, not measured.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

Plugging the sampling instants into our wave gives the actual numbers stored:

  • — the -th stored number (square brackets = "discrete index", not continuous time).
  • — the star of the show: the wave's frequency measured in units of the sampling rate. Watch this ratio.

Step 3 — The catastrophe: two different waves, identical dots

WHAT. Take our real wave of frequency . Now take a faster wave of frequency . Sample both at the same instants . Compare the stored numbers.

WHY this pair? Because is the "one full extra spin per sample" frequency. Adding it should sneak in an invisible full rotation between every pair of dots — invisible precisely because we never look mid-spin.

Let us check the math term-by-term:

  • The extra piece is .
  • is a whole number of full circles. Cosine returns to the exact same value after every full circle.

So:

The two waves produce byte-for-byte identical dots.

PICTURE. The magenta fast wave and the violet slow wave both thread through the same orange dots. Once you only have the dots, you cannot tell which curve made them.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

Step 4 — Which slow wave does the fast one pretend to be?

WHAT. Step 3 showed adding one changes nothing. So does adding two, three, or of them. That means , , , … all collapse to the same dots. To find the apparent frequency we peel off as many whole chunks as we can and keep the leftover.

WHY round, not floor? We want the nearest multiple of , because a wave and its mirror at also share dots (cosine is symmetric). Rounding to the closest multiple lands us on the smallest possible leftover — the frequency the ear/scope actually reports.

PICTURE. A number line of frequencies. Everything above the halfway mark folds back like a hinge onto a low frequency below it. That folding line is the villain and the hero at once.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

Step 5 — Watch it happen: 1800 Hz sampled at 1000 Hz

WHAT. A real 1800 Hz tone, dotted 1000 times per second.

WHY this example? is nearly twice the sampling rate — a textbook violation. Let us see the fake it produces.

Compute each piece:

PICTURE. The magenta 1800 Hz truth and the violet 200 Hz impostor share every orange dot. Your recording plays back a 200 Hz hum that was never in the room.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

Step 6 — The rule that forbids the masquerade

WHAT. We now demand: no wave in our signal may collide with a slower one. From Step 4, folding happens for any frequency above . So we simply forbid the signal from containing anything that high.

WHY strict "greater than", not "equal to"? Look at the boundary case : the dots can land exactly on the zero-crossings every single time, reading — the wave is there but the dots say "silence." So the safe condition is strictly faster than twice the top frequency.

PICTURE. The safe zone (below the fold line ) glows; the forbidden zone (above it) is where aliases are born. Keep all your signal energy in the glow.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

The practical way to guarantee is to physically delete everything above the fold line before the ADC with an anti-aliasing low-pass filter.


Step 7 — The two degenerate cases you must never trip on

WHAT. Two boundary scenarios where naïve intuition fails.

Case A — exactly on Nyquist, . — that only works if we sample the peaks. Shift the clock by a quarter cycle and every dot lands on a zero-crossing: . The wave vanishes. Lesson: equality is unsafe; this is why the parent note insists on the strict inequality and a comfort margin (CD audio uses kHz for a kHz limit, not the bare kHz).

Case B — a constant (DC), . for every sample. Every dot is the same height, a flat line. No wiggle, no ambiguity, no aliasing — DC is always safe, and it sits comfortably below any .

PICTURE. Left panel: the peak-sampled vs zero-crossing-sampled Nyquist wave — same wave, wildly different dots. Right panel: the placid DC line, all dots equal.

Figure — ADC - DAC — resolution, sampling rate, Nyquist

The one-picture summary

Every idea on this page collapses into a single frame: a true wave, its dots, the impostor those dots also fit, and the fold line that separates safe from stolen.

Figure — ADC - DAC — resolution, sampling rate, Nyquist
Recall Feynman retelling — the whole walkthrough in kitchen words

Picture drawing a wiggly wave by tapping your pencil down at a steady beat, dot, dot, dot. Between two taps you never look — so if the wave sneaks in an entire extra up-and-down while you blink, you never know. That means a really fast wave and a lazy slow wave can leave the exact same trail of dots. When you later connect the dots, you draw the lazy one — the fast tone got a disguise. To find the disguise, subtract off as many "one-full-extra-wiggle-per-tap" chunks as fit; whatever wiggle is left over is the fake pitch you'll hear (1800 Hz tapped 1000 times a second comes out as a fake 200 Hz). The cure is a speed rule: tap more than twice for the fastest wiggle you care about, and put a gate before the pencil that blocks anything faster from ever showing up. Exactly twice isn't enough, because your taps might land on the spots where the wave is crossing zero every time — and then your drawing is a dead-flat line pretending nothing was ever there.


Connections