Skip to content
Tactiverge

School/○ Innovator/Week 22

Sampling and the Nyquist rate

A computer can't watch a signal continuously; it takes snapshots. How many snapshots a second are enough to catch a 50 Hz hum?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

Every digital sensor reading is a sample. Choosing how often to sample is a real design decision: too slow and the data lies about what happened; too fast and you waste power, memory and processor time. The Nyquist rate is where that decision starts.

  • ◇ Describe sampling as measuring a signal at regular intervals 1/fs apart.
  • ◇ State the Nyquist rate (2 × the highest frequency) and why sampling must exceed it.
  • ◇ Choose a practical sample rate with a margin above the Nyquist rate.

2.Discover

Turn on sampling. Set f = 4 Hz and slowly lower fs from 40 Hz. Watch the dashed curve that fits the samples. At what fs does it stop matching the true wave? Repeat for f = 7 Hz. What is the rule?

Loading the interactive…

Can't use the interactive? Read a description instead

The signal scope samples a sine wave at a chosen rate. For f = 4 Hz, sample rates above 8 Hz give orange dots that follow the wave, and the dashed best-fit curve matches it. Below 8 Hz the dashed curve becomes a slower, different wave: at fs = 6 Hz the samples look like a 2 Hz wave.

3.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

You must capture a wheel encoder whose pulses repeat up to 120 Hz. What is the Nyquist rate (twice the highest frequency) you must sample above, in Hz?

Hz

4.Predict

You sample a 10 Hz sine wave at exactly 10 Hz. What do the samples look like?

Guess first. Being wrong here is how the surprise works.

5.Understand

Samples, not signals

A sampler measures the signal every Tₛ = 1/fₛ seconds, where fₛ is the sample rate in hertz. Between samples the computer knows nothing. Any two signals that agree at every sample instant are indistinguishable afterwards, however different they were in between.

The Nyquist rate

To capture a sine wave of frequency f, you need more than two samples per cycle: fₛ > 2f. For a signal whose highest frequency is f_max, the Nyquist rate is 2·f_max. Equivalently, a given fₛ can faithfully represent frequencies only up to fₛ/2, called the Nyquist frequency.

Margins in practice

Exactly 2f is a knife edge: sampled at the wrong phase, a wave right at the limit can vanish. Engineers sample with a comfortable margin, often 5–10 times the highest frequency of interest for control and monitoring, and use an analogue filter to remove anything above fₛ/2 before sampling.

Explain it another way

Photographing a spinning fan once per turn makes it look still. Photograph it a few times per turn and you can see which way it spins.

Worked example 1

A wheel encoder produces pulses at up to 300 Hz. What is the Nyquist rate, and what would you choose?

Nyquist rate = 2 × 300 = 600 Hz. A sensible choice is around 3–6 kHz so each pulse is seen several times and timing is precise.

Common mix-ups

  • Sampling at exactly twice the frequency is enough.
    ✓ You need more than twice; at exactly 2f a wave can vanish if sampled at its zero crossings.
  • Sampling faster always gives better data.
    ✓ Above a comfortable margin it mostly adds cost, and noise above the band of interest still needs filtering.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

A data logger samples at 250 Hz. What is the highest frequency it can represent unambiguously (the Nyquist frequency), in Hz?

Hz

Practice 3

A 40 Hz vibration is sampled at 1 kHz. How many samples fall in each cycle?

Practice 4

A temperature is sampled once a minute. A heater spike lasting 10 seconds happens between samples. What does the log show?

Practice 5

Why sample well above the Nyquist rate in practice?

7.Apply it

A walking robot's leg sensors should capture gait (about 2 Hz) and foot impacts (energy up to 80 Hz). Pick a sample rate, justify it from the Nyquist rate with a margin, and estimate how many bytes per minute you'd log for six 16-bit sensors.

8.Reflect

Concepts: Sampling rate and aliasing · Signals: amplitude, frequency and period · Analog-to-digital conversion