Textbooks/Signals and Systems/Chapter 7Lite (plain text) version
7The DFT: measuring a spectrum
Version 1 · Technically checked (automated checks only) · 2 source lessons · 7 practice items
Introduction
Given a list of samples, the discrete Fourier transform asks one question per frequency bin: how much of this wave is in the signal? It answers by correlating the samples with a test sinusoid. The bins are spaced by the sample rate divided by the number of samples, so a longer recording resolves finer detail. Transforms like this let engineers change the question, from "what happens next?" to "which frequencies are there?"
Explanation
This chapter is built from 2 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.
7.1 The DFT: asking 'how much of this wave?'
A computer only has eight numbers from a sensor. How can it say there is a strong 250 Hz component in them?
Correlation with probes
X[k] = Σ x[n]·cos(2πkn/N) − j·Σ x[n]·sin(2πkn/N). Each bin multiplies the signal by a probe wave with k cycles in the window and adds up. If the signal contains that wave, products are mostly positive and the sum is big; otherwise positives and negatives cancel. The cosine and sine sums together catch the component whatever its phase.
Bins and frequencies
With N samples at rate fs, bin k corresponds to f = k·fs/N. Resolution is fs/N: to tell close frequencies apart, record for longer. For a real signal, bins above N/2 mirror those below (they are the negative frequencies). A pure cosine of amplitude A exactly on bin k gives |X[k]| = A·N/2.
Small enough to do by hand
For N = 4 the probes take only the values 1, 0 and −1, so X[0] = x0 + x1 + x2 + x3, X[2] = x0 − x1 + x2 − x3, and X[1] = (x0 − x2) − j(x1 − x3). For x = [1, 0, −1, 0], X[1] = 2: one cycle of a cosine, amplitude 1, times N/2 = 2.
Common mix-ups
- The DFT finds frequencies by guessing.
✓ It is plain multiply-and-add: correlation with fixed probe waves. - Sampling faster gives finer frequency resolution.
✓ Resolution is set by the recording length, 1/(N·T).
Open the full lesson: The DFT: asking 'how much of this wave?' →
7.2 Transforms: why engineers change the question
Filtering is a messy running sum in time but a simple multiplication in frequency. What other hard problems become easy when you transform them?
Filtering = multiplying spectra
In time, a filter output is a weighted running sum of the input (a convolution). In frequency, the same operation is just Y(f) = H(f)·X(f): each component is scaled by the gain at its frequency and shifted by the phase. That is why a frequency response is the most useful single description of a filter.
Low-pass, high-pass, and the rest
Low-pass keeps slow changes (smoothing, anti-aliasing). High-pass keeps fast changes and removes offsets and drift (AC coupling, removing gyro bias). A band-pass keeps a range (radio tuning), and a notch removes one frequency (mains hum). High-pass can be built as 1 − low-pass.
The Laplace transform, conceptually
The Fourier transform describes a signal with steady sinusoids. The Laplace transform uses e^{st} with complex s = σ + jω: sinusoids that can also grow or decay. Differentiation becomes multiplication by s, so a circuit's differential equation becomes algebra, e.g. an RC low-pass has H(s) = 1/(1 + sRC). Where H(s) blows up (its poles) tells you whether a system is stable.
Common mix-ups
- A transform changes the signal.
✓ It is the same signal described differently; you can always transform back.
Open the full lesson: Transforms: why engineers change the question →
Worked examples
The DFT: asking 'how much of this wave?': example 1
Compute all four DFT bins of x = [2, 1, 0, 1].
Solution
X[0] = 4. X[2] = 2 − 1 + 0 − 1 = 0. X[1] = (2 − 0) − j(1 − 1) = 2. X[3] = 2. So DC of 1 (4/N) plus one cosine cycle of amplitude 1 (2·2/N).
Transforms: why engineers change the question: example 1
A sensor reading is 2.5 V of steady offset plus a 5 Hz vibration plus 200 Hz noise, sampled at 1 kHz. Which filter keeps just the vibration?
Solution
A band-pass around 5 Hz: a high-pass to remove the 2.5 V DC, followed by a low-pass that cuts 200 Hz. In frequency: H is about 0 at 0 Hz, about 1 at 5 Hz and about 0 at 200 Hz.
Interactive figures
Interactive figure (online). Description: For the signal cos(2·2πn/8) + ½·sin(3·2πn/8), the probe shows |X[k]| = 4 at k = 2 and 6 (cosine part, through the Σx·cos column) and 2 at k = 3 and 5 (sine part, through the Σx·sin column); every other bin is zero.
Interactive figure (online). Description: Reading the explorer: both low-pass filters have gain 1 at 0 and small gain near 0.45; both high-pass filters have gain 0 at 0 and close to 1 at high frequencies. On a drifting, noisy sensor the low-pass keeps the drift and removes the noise; the high-pass removes the drift and keeps the noise.
Laboratory
Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.
Studio
Code Lab
Compute one DFT bin by correlating 100 samples with a test sine and cosine, then check it against a library FFT.
Open Code Lab →BUILD level
BUILD: Washing machine, level 3
Identify the drum's wobble frequency from its vibration and relate it to the spin speed.
Open BUILD: Washing machine, level 3 →
Guided practice
Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.
- In an N-point DFT, what does bin k measure?
- The kth sample
- How much the signal matches a wave with k cycles in the window
- The signal's energy up to sample k
- The kth harmonic of the sample rate
- x = [1, 0, −1, 0]. What is |X[1]| of its 4-point DFT?
- A 1024-point DFT is taken of a signal sampled at 8 kHz. What frequency, in Hz, does bin k = 64 represent? (Hz)
- You need to tell 100 Hz and 102 Hz apart. What helps most?
- A higher sample rate with the same N
- A longer recording (larger N at the same fs)
- Fewer bits
- Taking the DFT twice
- Filtering in time corresponds to what in frequency?
- Adding the filter's response
- Multiplying the spectrum by the filter's response
- Dividing by the sample rate
- Nothing simple
- Which job needs a high-pass filter?
- Smoothing a jittery thermometer
- Removing a slowly drifting offset from a microphone signal
- Anti-aliasing before an ADC
- Averaging a battery voltage
- What does the Laplace transform mainly do for an engineer?
- Speed up sampling
- Turn differential equations into algebra and reveal stability through poles
- Compress audio files
- Replace the DFT in digital filters
Engineering applications
Tuners and analysers
A guitar tuner records a fraction of a second of sound, takes its spectrum and finds the strongest peak. The recording length sets how finely it can tell two nearby notes apart.
Fast algorithms
Computing a DFT directly takes about N² operations; the fast Fourier transform needs about N log N. That difference is why spectra can be computed in real time on small processors.
Watch
Optional verified videos. Nothing loads from YouTube until you press play.
- But what is the Fourier Transform? A visual introduction. (3Blue1Brown)
- The Most Underrated Algorithm (Veritasium)
- The Fast Fourier Transform (FFT) (Steve Brunton)
Chapter summary
- Each DFT bin correlates the samples with a sinusoid at one frequency.
- Bin k corresponds to k × fs / N hertz; resolution is fs / N.
- Useful bins run up to N / 2, the Nyquist frequency.
- Transforms turn convolution in time into multiplication in frequency, which is why filters are easier to understand there.
Glossary
- Sampling and aliasing
- Sampling measures a signal at regular intervals. Any frequency above half the sample rate, the Nyquist frequency, is indistinguishable from a lower 'alias' frequency.
- Frequency and period
- Frequency is how many cycles happen per second; the period is the time for one cycle. Each is the reciprocal of the other.
- Low-pass filter (moving average and EMA)
- A low-pass filter lets slow changes through and attenuates fast ones. In firmware the simplest are the moving average and the exponential moving average.
Definitions from the Field Guide.
Project: Find the hidden tones
Generate a signal from two sinusoids 3 Hz apart plus noise, sampled at 200 Hz. Compute its spectrum with recordings of 1 s, 2 s and 4 s, and find the shortest recording that separates the two peaks. Explain the result with the bin spacing.
Deliverables
- Spectra for the three recording lengths
- The shortest length that separates the peaks
- An explanation using fs / N
Keep your work in your Engineering Journal; it stays private unless you choose to share it.
References
- James W. Cooley and John W. Tukey (1965). "An Algorithm for the Machine Calculation of Complex Fourier Series". Mathematics of Computation 19(90), 297–301.
- Alan V. Oppenheim and Ronald W. Schafer (2010). Discrete-Time Signal Processing, 3rd edition. Pearson.
- Richard G. Lyons (2010). Understanding Digital Signal Processing, 3rd edition. Prentice Hall.
Publication record
- Version
- 1
- Status
- Technically checked (automated checks only)
- Technical review
- Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
- Written by
- Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
- Licence
- All rights reserved by the founders unless a licence is approved.
- Corrections
- None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.