Any periodic signal is a sum of sinusoids
Let x(t) repeat every T0 seconds. Apart from some pathological signals, it can be written at nearly every t as
The kth pair of terms has frequency kω0 and is called the kth harmonic. The constant a0 is a sinusoid of zero frequency, called the DC component. Once we know the coefficients, they specify the signal completely.
The coefficients are found by integrating over any one period:
Each integral measures how much the signal looks like one particular sinusoid. Here T0 = 2 s, so ω0 = π rad/s. Choose a signal, then add harmonics one at a time and watch the sum close in on it. You can also draw your own period.
The sum with N harmonics
- DC, a₀
- —
- largest value of the sum
- —
- RMS error over a period
- —
- highest frequency
- —
What to notice
A few harmonics already give the general shape. Smooth signals such as the triangle wave converge quickly, because their coefficients fall off like 1/k2. Signals with jumps, such as the square wave, converge slowly, because their coefficients fall off only like 1/k.
Near a jump the sum always overshoots. Adding harmonics squeezes the overshoot closer to the jump, but it does not make it smaller: the peak stays near 9% of the size of the jump. This is the Gibbs phenomenon of footnote 6. The RMS error still goes to zero, because the region where the overshoot lives becomes very narrow.
Symmetry decides which coefficients survive. An even signal, with x(−t) = x(t), needs only cosines; an odd one needs only sines. The shifted pulse is neither, so it needs both.
Try these
- Choose the square wave. Before looking at the table, decide which of ak and bk must be zero, and why the even harmonics are missing.
Show answer
The square wave here is odd, so every cosine coefficient ak and the mean a0 are zero. It also satisfies x(t + T0/2) = −x(t). An even harmonic is unchanged by a shift of half a period, so it cannot match a signal that changes sign under that shift. The integral for bk gives 4/(kπ) for odd k and 0 for even k: 1.2732, 0.4244, 0.2546, … - With the square wave, read the largest value of the sum at N = 9, 19 and 49. Does adding harmonics remove the overshoot?
Show answer
No. The peak stays near 1.18 (1.1790 at N = 49) while the jump is from −1 to 1, so the overshoot is about 0.18, or 9% of the jump. The peak just moves closer to the jump. Meanwhile the RMS error keeps falling. This is why footnote 6 warns that the error near a jump does not go away, even with many tens of terms. - Compare the square and triangle waves at N = 5. Which has the smaller RMS error, and how does the bar chart explain it?
Show answer
The triangle wave's error is far smaller. Its coefficients are 8/(kπ)2 for odd k, so the fifth harmonic is already 25 times smaller than the first. The square wave's coefficients fall only as 1/k, so the harmonics left out still carry a lot. In general, the smoother the signal, the faster its coefficients fall. - Choose the shifted pulse (1 on 0 < t < 0.5). Predict a0, then explain why both ak and bk appear.
Show answer
a0 is the average value, 0.5/2 = 0.25. The pulse is neither even nor odd about t = 0, so it needs both cosines and sines. Each harmonic is then a single sinusoid with a phase shift, of amplitude √(ak2 + bk2). Compare with the centred pulse, which is even and has only cosine terms.
Each harmonic is a pair of rotating phasors
Recall from Section 5.1.1 that a sinusoid is generated by a rotating phasor. The kth harmonic ak cos kω0t + bk sin kω0t comes from two phasors of lengths ak and bk, 90 degrees apart, both turning at kω0. Their real parts add up to the harmonic. This is the sinusoidal form.
Using Euler's formula (EQ 5.5 and 5.6), each cosine and sine is also a pair of counter-rotating phasors. Collecting terms, with c0 = a0, ck = ½(ak − jbk) and c−k = ½(ak + jbk),
This complex form is a sum of phasors turning at every multiple of ω0, both counterclockwise (k > 0) and clockwise (k < 0). Each ck is a complex number: its magnitude is the phasor's length and its angle is the phasor's starting angle. For a real signal, c−k is the complex conjugate of ck, so each pair is a mirror image and their sum stays on the real axis.
Writing ck = |ck|ejθk, each pair of phasors is
So each phasor turns at kω0 but starts at the angle θk, and the pair is the kth harmonic with amplitude 2|ck| = √(ak2 + bk2) and phase θk = −atan2(bk, ak). The starting angle is how the complex form carries the sine terms. A real ck (θk = 0 or π) gives a pure cosine, as for the even pulse train of Example 5.9. For the square wave, c1 = −j(2/π), so θ1 = −π/2 and the pair is (4/π) cos(ω0t − π/2) = (4/π) sin ω0t.
- angle kω₀t
- —
- ak cos kω₀t
- —
- bk sin kω₀t
- —
- sum
- —
The bk phasor is always a quarter turn behind the ak phasor, so the pair rotates like a rigid frame. The real part of a phasor of length ak at angle kω0t is ak cos kω0t; a quarter turn back, the real part of the other is bk sin kω0t. Their sum is a single phasor of length A = √(ak2 + bk2), lagging by φ = atan2(bk, ak), so every harmonic is one sinusoid with an amplitude and a phase. In 3D, time runs along the axis, so each phasor traces a helix and the two helices stay a quarter turn apart. Face on, you see the familiar complex plane; from the side (Re against t), each helix casts its shadow as the cosine, sine or sum on the right. The time slider and Play button below drive this panel too.
The coefficients
What to notice
In the complex form, every phasor ck has a partner c−k of the same length turning the opposite way. Their imaginary parts cancel at every instant, so the tip of the chain slides back and forth along the real axis and traces out the signal itself.
In the sinusoidal form there is only one direction of rotation, so the tip wanders over the plane. Only its shadow on the real axis (the dashed drop line) is the signal. Both forms give the same real part at every time, because they are the same series written two ways.
The spectrum is symmetric: |c−k| = |ck|. Each |ck| is half the amplitude √(ak2 + bk2) of the kth harmonic, because the harmonic is split equally between positive and negative frequency.
Try these
- For the square wave, compute c1 and c−1 from a1 = 0 and b1 = 4/π. Then check the table, and find the two phasors at t = 0.
Show answer
c1 = ½(0 − j·4/π) = −j0.6366 and c−1 = +j0.6366. At t = 0 they point straight down and straight up, so they cancel. A quarter of a period later (t = 0.5) both have turned by 90 degrees, one each way, and both point along the positive real axis: the sum is 1.2732, the peak of the first harmonic. - Switch between the two forms at the same N and t. Which quantity is the same in both, and which is not?
Show answer
The real part of the tip is the same in both: it is the partial sum, plotted below. The imaginary part is not. In the complex form it is always zero (look at the readout). In the sinusoidal form it is the sum of ak sin kω0t − bk cos kω0t, which has no meaning for the signal. - Choose the sawtooth. Why is every ck purely imaginary? Choose the triangle wave. Why is every ck real?
Show answer
The sawtooth is odd, so ak = 0 and ck = −jbk/2. The triangle wave is even, so bk = 0 and ck = ak/2. The book's remark that each phasor has a "real magnitude ck" holds for even signals such as Example 5.9; in general ck is complex, with magnitude |ck| and a starting angle.
Example 5.9: the coefficients of a pulse train lie on a sinc curve
Take the train of rectangular pulses in Figure 5.9: height 1, width τ, one centred at each multiple of T0. Integrating over [−T0/2, T0/2], where the signal is 1 only on [−τ/2, τ/2], EQ 5.33 gives
The pulse train is even, so every ck is real.
The coefficients are samples, at ω = kω0, of one continuous curve:
The function sin(x)/x is the sinc function. It is 1 at x = 0, and elsewhere it is a sine wave whose amplitude falls off as 1/x. The envelope is zero where ωτ/2 = mπ, m ≠ 0, that is at ω = 2mπ/τ. The pulse width sets the envelope; the period sets how densely it is sampled.
EQ 5.36 writes the envelope as X(ω), a function of the real frequency ω. Section 5.7 writes the Fourier transform as X(jω) instead. The two mean the same thing; the jω form is a convention that links the Fourier transform to the Laplace transform, as the Fourier Transform Lab explains.
Readings
- ω₀ = 2π/T₀
- —
- c₀ = τ/T₀
- —
- first zero, 2π/τ
- —
- T₀/τ
- —
What to notice
Change τ and only the envelope changes: a narrow pulse has a wide envelope, and a wide pulse a narrow one. Change T0 and the envelope keeps its zero crossings, but the samples move: they are spaced ω0 = 2π/T0 apart. When T0/τ is a whole number, some harmonics land exactly on zero crossings and vanish.
As T0 grows, the pulses move apart, the samples crowd together, and the whole envelope shrinks in proportion to 1/T0. In the limit the pulse train becomes a single pulse, and the samples fill in the sinc curve. That limit is the Fourier transform of the next section; the Fourier Transform Lab picks up from here.
Try these
- Set τ = 1 and T0 = 5. Which coefficients are zero, and how many coefficients lie inside the main lobe?
Show answer
ω0 = 2π/5 and the first zero of the envelope is at 2π, so c±5, c±10, … are zero. The main lobe holds c−4 to c4, nine coefficients. In general the zeros fall at multiples of k = T0/τ whenever that is a whole number. - Keep τ = 1 and double T0 from 5 to 10. What happens to c0, to the spacing of the samples, and to the zero crossings?
Show answer
c0 halves from 0.2 to 0.1, because the pulse occupies half as much of each period. The samples are half as far apart (ω0 falls from 1.2566 to 0.6283 rad/s). The zero crossings do not move, because they depend only on τ. Twice as many coefficients now fit in the main lobe. - Keep T0 = 5 and halve τ from 1 to 0.5. What happens to the envelope? What does this say about short pulses?
Show answer
The first zero moves out from 2π to 4π rad/s, so the envelope is twice as wide and half as tall. A shorter pulse needs more harmonics, at higher frequencies, to describe it. This trade-off between duration in time and width in frequency reappears as the time-scaling property of the Fourier transform (Example 5.15).