Skip to content
Tactiverge

Textbooks/Applied Engineering Mathematics/Chapter 5Lite (plain text) version

5Fourier and transform thinking

Version 1 · Technically checked (automated checks only) · 5 source lessons · 8 practice items

Text
All chapters and search
  1. 1. Linear systems in practice
  2. 2. Least squares and model fitting
  3. 3. Linearisation, Jacobians and Newton's method
  4. 4. Differential equations and stability
  5. 5. Fourier and transform thinking
  6. 6. Numerical methods and their errors
  7. 7. Statistics for engineering evidence
  8. 8. Estimation and error budgets

Introduction

Sometimes the best way to answer a question about a signal is to ask a different question: not 'what is its value now?' but 'how much of each frequency does it contain?'. This chapter builds signals from sinusoids, rebuilds a square wave from its odd harmonics, measures frequency content with the discrete Fourier transform, and sees filtering in time as multiplication in frequency.

t (one period)x(t)harmonics11.27330.42450.255amplitude of harmonic n = 4/(nπ), odd n only
Figure 5.1. A square wave from three sinusoids. A square wave of height ±1 over one period, with the sum of its first three odd harmonics drawn over it. A bar chart shows the harmonic amplitudes 4/(nπ): 1.273 for n = 1, 0.424 for n = 3 and 0.255 for n = 5. Even harmonics are zero.

Explanation

This chapter is built from 5 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.

5.1 Seeing a signal's ingredients

A chord played on a piano is one wobbly line on an oscilloscope. How can a tuner app name every note in it?

Two views of one signal

The time domain shows value against time. The frequency domain shows how much of each frequency is present. A magnitude spectrum draws a bar of height Aᵢ at each fᵢ. The same information, arranged differently, like a recipe versus the cake.

Phase hides in the time view

Shifting a component's phase reshapes the waveform (peaks can line up or cancel) but leaves its bar the same. That is why two signals that look different can sound identical: your ear cares mostly about magnitudes. A full description keeps the phase too, so the time signal can be rebuilt.

Power adds across frequencies

Sinusoids of different frequencies average to zero when multiplied together, so the cross terms vanish and P = Σ Aᵢ²/2. That is Parseval's theorem in miniature: power computed in time equals power computed from the spectrum. Components at the same frequency are different: they combine as phasors first.

Common mix-ups

  • If two waveforms look different, their spectra must be different.
    ✓ Phase changes the look without changing the magnitude spectrum.
  • Amplitudes always add.
    ✓ Only powers of different frequencies add simply; same-frequency components add as phasors.

Open the full lesson: Seeing a signal's ingredients →

5.2 A square wave made of curves

A square wave has perfectly sharp corners. Sine waves have none. Yet enough sine waves add up to a square. How many, and what's left over?

The series

A square wave swinging between +A and −A is x(t) = (4A/π)·[sin ωt + sin 3ωt/3 + sin 5ωt/5 + …]. Harmonic n has amplitude bₙ = 4A/(nπ) for odd n and 0 for even n. The fundamental is 4/π ≈ 1.27 times taller than the square itself.

Power is concentrated low

The square has power A². The fundamental alone carries (4A/π)²/2 = 8A²/π² ≈ 81 % of it; adding the 3rd and 5th reaches about 93 %. So a square wave through a low-pass filter quickly looks like a sine: that is how some cheap sine-wave inverters work.

Gibbs: the overshoot that won't go away

Near each jump the partial sum overshoots by about 9 % of the jump, however many terms you add. More terms make the overshoot narrower, not lower. In practice, ringing near edges in a band-limited system is the same effect: a sharp edge truly needs infinitely high frequencies.

Common mix-ups

  • Enough harmonics make a perfect square wave with no overshoot.
    ✓ The partial sums always overshoot by about 9 % near jumps; only the width shrinks.
  • The fundamental of a ±1 square wave has amplitude 1.
    ✓ It is 4/π ≈ 1.27: taller than the square, with the harmonics trimming it back down.

Open the full lesson: A square wave made of curves →

5.3 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?' →

5.4 The moving average, seen in frequency

Averaging the last four readings smooths a sensor beautifully. So why does it completely erase one particular frequency?

One line of code

y[n] = (x[n] + x[n−1] + … + x[n−M+1])/M. It is a finite impulse response (FIR) filter: an impulse affects exactly M outputs, then is forgotten. Random noise of standard deviation σ comes out with σ/√M, because independent errors partly cancel.

Nulls and side lobes

Its gain is 1 at DC and falls to exactly zero at fs/M, 2fs/M, …, with bumps (side lobes) in between: the first is about 0.22 for large M. Great for removing a known interference, like 50 Hz mains when fs/M = 50 Hz, but a mediocre general low-pass because the side lobes leak.

The price: lag

The output is centred (M − 1)/2 samples in the past. With M = 9 at 100 Hz that is 40 ms: fine for a thermometer, dangerous inside a fast control loop where delay erodes stability. Doubling M halves the noise power again but doubles the lag.

Derivation: The moving-average frequency response
  1. Input x[n] = e^{jωn} with ω = 2πf/fs. Output y[n] = (1/M)·Σ_{k=0}^{M−1} e^{jω(n−k)} = e^{jωn}·H, with H = (1/M)·Σ e^{−jωk}.

  2. That is a geometric series: H = (1/M)·(1 − e^{−jωM})/(1 − e^{−jω}).

  3. Factor out half-angles: (1 − e^{−jθ}) = e^{−jθ/2}·2j·sin(θ/2).

  4. So |H| = |sin(ωM/2) / (M·sin(ω/2))| = |sin(πMf/fs)/(M·sin(πf/fs))|, with a pure delay of (M − 1)/2 samples.

  5. It is 1 at f = 0 and 0 whenever Mf/fs is a whole number (other than multiples of M): nulls at f = fs/M, 2fs/M, …

Common mix-ups

  • A longer moving average is always better.
    ✓ It smooths more but lags more; inside a control loop the lag can cause oscillation.
  • A moving average blocks all frequencies above its cut-off.
    ✓ Its side lobes let some high frequencies leak through; it is only zero at the nulls.

Open the full lesson: The moving average, seen in frequency →

5.5 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

Seeing a signal's ingredients: example 1

Sketch the spectrum of 3 + 2·cos(2π·10t) + sin(2π·30t).

Solution

A bar of height 3 at 0 Hz (DC), height 2 at 10 Hz and height 1 at 30 Hz. Power = 3² + 2²/2 + 1²/2 = 9 + 2 + 0.5 = 11.5.

A square wave made of curves: example 1

A ±5 V, 1 kHz square wave drives a speaker. What is the amplitude of the 3 kHz component?

Solution

n = 3: b₃ = 4 × 5/(3π) ≈ 2.12 V.

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).

The moving average, seen in frequency: example 1

A 5-point moving average filters x = [2, 4, 6, 8, 10, 12]. Find y[4] and y[5].

Solution

y[4] = (2 + 4 + 6 + 8 + 10)/5 = 6. y[5] = (4 + 6 + 8 + 10 + 12)/5 = 8. A ramp comes out as the same ramp delayed by (5 − 1)/2 = 2 samples.

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

Figure 5.2 from Seeing a signal's ingredientsLoad 'Three tones'. Read the spectrum bars, then change each phase and watch the time plot. Next put two components at the same frequency and vary one phase: what happens to that bar now?
Can't use the interactive? Read a description instead

With three tones at 2, 5 and 8 Hz the spectrum shows three bars of heights 1, 0.6 and 0.3. Changing phases changes the waveform's shape but not the bars. Putting two components at the same frequency makes one bar whose height depends on their phase difference (from the sum to the difference of the amplitudes).

Interactive figure (online). Description: With three tones at 2, 5 and 8 Hz the spectrum shows three bars of heights 1, 0.6 and 0.3. Changing phases changes the waveform's shape but not the bars. Putting two components at the same frequency makes one bar whose height depends on their phase difference (from the sum to the difference of the amplitudes).

Figure 5.3 from A square wave made of curvesStart with 1 harmonic, then add them one by one up to 25. Watch the power captured and the peak of the sum. Does the overshoot near the jump get smaller, or only narrower?
Can't use the interactive? Read a description instead

With 1 harmonic the builder draws a sine of peak 1.27 over the square. Adding odd harmonics (3, 5, 7…) fills in the corners; captured power rises from 81 % to about 98 % with 13 terms; the peak near each jump stays about 1.18, a 9 % overshoot of the jump of 2.

Interactive figure (online). Description: With 1 harmonic the builder draws a sine of peak 1.27 over the square. Adding odd harmonics (3, 5, 7…) fills in the corners; captured power rises from 81 % to about 98 % with 13 terms; the peak near each jump stays about 1.18, a 9 % overshoot of the jump of 2.

Figure 5.4 from The DFT: asking 'how much of this wave?'Pick 'cos 2 + ½·sin 3'. Step the probe k from 0 to 7, watching the products column. Which k give big sums, and why do the cosine part and the sine part show up in different columns?
Can't use the interactive? Read a description instead

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: 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.

Figure 5.5 from The moving average, seen in frequencyChoose 'Moving average', low-pass. Set M = 4 and slide the test frequency to find the null. Change M to 8 and 2: where do the nulls go? Watch the step response: how many samples does it take to reach the top?
Can't use the interactive? Read a description instead

In the explorer, the 4-point moving average has gain 1 at 0, falls to about 0.77 at f/fs = 0.1, and reaches 0 at f/fs = 0.25 (a null), with a small bump after it. With M = 8 the first null moves to 0.125. The step response climbs in M equal steps to 1.

Interactive figure (online). Description: In the explorer, the 4-point moving average has gain 1 at 0, falls to about 0.77 at f/fs = 0.1, and reaches 0 at f/fs = 0.25 (a null), with a small bump after it. With M = 8 the first null moves to 0.125. The step response climbs in M equal steps to 1.

Laboratory

Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.

  • Studio

    Code Lab

    Compute an 8-point DFT by hand-written correlation and check that a pure sinusoid lights up exactly one pair of bins.

    Open Code Lab →
  • Studio

    Electronics Studio

    Build an RC low-pass filter and predict, from its cut-off frequency, which harmonics of a square wave survive.

    Open Electronics Studio →

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.

Practice 1

x(t) = 2·sin(2π·50t) + 1·sin(2π·150t). What is its average power?

Practice 2

Where does a constant offset appear in a spectrum?

Practice 3

What is the amplitude of the fundamental of a ±1 square wave (3 decimal places)?

Practice 4

You add more and more harmonics. What happens to the overshoot near each jump?

Practice 5

A 1024-point DFT is taken of a signal sampled at 8 kHz. What frequency, in Hz, does bin k = 64 represent?

Hz

Practice 6

You need to tell 100 Hz and 102 Hz apart. What helps most?

Practice 7

A moving average with M = 10 runs at fs = 500 Hz. What is the lowest frequency it removes completely, in Hz?

Hz

Practice 8

Filtering in time corresponds to what in frequency?

  1. x(t) = 2·sin(2π·50t) + 1·sin(2π·150t). What is its average power?
  2. Where does a constant offset appear in a spectrum?
    • At the highest frequency
    • Nowhere
    • At 0 Hz
    • Spread evenly over all frequencies
  3. What is the amplitude of the fundamental of a ±1 square wave (3 decimal places)?
  4. You add more and more harmonics. What happens to the overshoot near each jump?
    • It shrinks to zero
    • It stays about 9 % of the jump but gets narrower
    • It grows without limit
    • It moves to the middle of the flat parts
  5. A 1024-point DFT is taken of a signal sampled at 8 kHz. What frequency, in Hz, does bin k = 64 represent? (Hz)
  6. 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
  7. A moving average with M = 10 runs at fs = 500 Hz. What is the lowest frequency it removes completely, in Hz? (Hz)
  8. 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

Engineering applications

  • Machine condition monitoring

    A failing bearing adds energy at frequencies set by its geometry and shaft speed. A spectrum of a vibration sensor shows the fault long before it can be heard.

  • Choosing a filter

    Knowing that a motor's switching noise sits at 20 kHz while the signal stays below 100 Hz tells you what filter to design. In frequency, the job becomes obvious.

Watch

Optional verified videos. Nothing loads from YouTube until you press play.

Builds sharp-cornered functions, including a square wave, out of rotating sinusoids, and shows where the 4/(nπ)-style coefficients come from.

24 min 47 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Winds a signal around a circle at different speeds to show how a transform picks out the frequencies hiding inside it: the same idea as the DFT's correlation with probe waves.

19 min 41 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

The story of the fast Fourier transform: why computing a spectrum quickly mattered enough to change science and engineering.

26 min 33 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Presents the Laplace transform as a generalised Fourier transform, the tool behind transfer functions.

16 min 28 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

  • But what is a Fourier series? From heat flow to drawing with circles | DE4 (3Blue1Brown)
  • But what is the Fourier Transform? A visual introduction. (3Blue1Brown)
  • The Most Underrated Algorithm (Veritasium)
  • The Laplace Transform: A Generalized Fourier Transform (Steve Brunton)

Chapter summary

  • A periodic signal is a sum of sinusoids; its spectrum lists their amplitudes and phases.
  • A symmetric square wave contains only odd harmonics, with amplitudes 4/(nπ).
  • DFT bin k measures how much of frequency k·fs/N the samples contain; resolution is fs/N.
  • Convolution in time is multiplication in frequency, so a filter is a frequency-by-frequency gain.

Glossary

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.
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.
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.
Logarithms and decibels
A logarithm answers 'what power gives this number?'. Decibels use logarithms to express ratios: 10 log10 for power ratios and 20 log10 for amplitude ratios.

Definitions from the Field Guide.

Project: What is in that hum?

Generate or record a signal that mixes a 50 Hz hum, its third harmonic and noise. Compute its DFT, identify each component and its amplitude, then design a moving-average or first-order filter and show its effect on the spectrum.

Deliverables

  • The signal definition and sample rate
  • A labelled spectrum before and after filtering
  • A justification of the filter choice in frequency terms

Keep your work in your Engineering Journal; it stays private unless you choose to share it.

References

  • Alan V. Oppenheim et al. (1997). Signals and Systems, 2nd edition. Prentice Hall.
  • Erwin Kreyszig (2011). Advanced Engineering Mathematics, 10th edition. Wiley.

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.