TactivergeLite

Lite / Textbooks / Signals and Systems / Chapter 6

6. Sinusoids and Fourier series

Version 1 · Technically checked (automated checks only) · 2 source lessons · Full interactive version

Introduction

Add sinusoids together and you can build almost any repeating shape. A spectrum is the recipe: a bar for each ingredient frequency, its height the amplitude. A square wave, all sharp corners, turns out to be odd harmonics only, with amplitudes falling as one over the harmonic number. Seeing signals as sums of sinusoids is the change of viewpoint that makes filters, music and radio understandable.

Figure 6.1. A square wave is odd harmonics only (described in words)

The spectrum of a unit square wave: bars only at odd harmonics, with amplitude 4/(πk). k = 1: 1.273, k = 3: 0.424, k = 5: 0.255, k = 7: 0.182; even harmonics are absent.

Explanation

Built from 2 School lessons. Each part is the lesson's own explanation.

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

Open the Lite lesson: Seeing a signal's ingredients

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

Open the Lite lesson: A square wave made of curves

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.

Interactive figures, in words

Figure 6.2 from Seeing a signal's ingredients

Load '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?

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 6.3 from A square wave made of curves

Start 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?

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.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

Practice

Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.

  1. You change only the phase of one component. What changes?
    Answer it in “Seeing a signal's ingredients”
  2. 3·sin(2π·5t) + 4·sin(2π·5t + 90°) is a single 5 Hz sinusoid. What is its amplitude?
    Answer it in “Seeing a signal's ingredients”
  3. Where does a constant offset appear in a spectrum?
    Answer it in “Seeing a signal's ingredients”
  4. What is the amplitude of the fundamental of a ±1 square wave (3 decimal places)?
    Answer it in “A square wave made of curves”
  5. What is the amplitude of the 4th harmonic of a symmetric square wave?
    Answer it in “A square wave made of curves”
  6. What percentage of a square wave's power is in its fundamental alone (8/π² as a percentage, 1 decimal place)?
    Answer it in “A square wave made of curves”
  7. You add more and more harmonics. What happens to the overshoot near each jump?
    Answer it in “A square wave made of curves”

Engineering applications

Musical timbre

A flute and a violin playing the same note share a fundamental frequency but carry different mixtures of harmonics. That recipe, the spectrum, is what makes them sound different.

Switching interference

PWM and digital clocks are square-ish waves, so they radiate energy at many odd harmonics. Engineers check those harmonics against radio-interference limits and slow the edges if needed.

Watch (optional)

Streaming video uses a lot of data. Everything you need is in the text.

Summary

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. Field Guide
Sine, cosine and tangent
In a right-angled triangle, sine is opposite over hypotenuse, cosine is adjacent over hypotenuse and tangent is opposite over adjacent, each a function of the angle. Field Guide

Project: Build a waveform from recipes

Write a program that synthesises a waveform from a list of (frequency, amplitude, phase) ingredients. Use it to approximate a square wave and a sawtooth, plot each with 3, 10 and 30 terms, and measure how the Gibbs overshoot behaves as terms are added.

Deliverables

Write it up on paper or in your own notes. Lite never stores what you write.

References

← 5. Smoothing filters7. The DFT: measuring a spectrum →