Fourier Series
A Fourier series writes a periodic waveform as a sum of sinusoids whose frequencies are whole-number multiples of the waveform's repetition rate: a constant, a fundamental, and a series of harmonics. Electronics needs it wherever a repeating waveform meets a circuit whose behavior depends on frequency. A clock's edges set the bandwidth it occupies, a rectifier's output sets the ripple its filter must remove, a switching converter's pulses set the harmonics its output filter must attenuate, and a distorted line current sets the total harmonic distortion that power-quality limits cap. Because a linear circuit treats each sinusoid independently, the series turns one hard problem into many easy phasor problems.
The Laplace Transform article covers transients, and Transform Processing covers the algorithms that compute spectra from sampled data.
Joseph Fourier presented his memoir "On the Propagation of Heat in Solid Bodies" to the Paris Institute on 21 December 1807. Lagrange and Laplace objected in 1808 to its expansions of functions as trigonometric series, and Fourier published his Théorie analytique de la chaleur in 1822. In 1829 Peter Gustav Lejeune Dirichlet published the first rigorous proof that the series converges for a broad class of functions, in the Journal für die reine und angewandte Mathematik.
Periodic Signals and Harmonics
Period, Fundamental, and Harmonics
A signal f(t) is periodic when f(t + T) = f(t) for every t, and its period T is the smallest positive number for which this holds. Its fundamental frequency is f0 = 1/T in hertz, or ω0 = 2πf0 = 2π/T in radians per second. The nth harmonic has the frequency nf0, so a 1 kHz waveform has its second harmonic at 2 kHz and its third at 3 kHz. The fundamental is the first harmonic, and the constant term is the DC component, the average value over one period.
A sum of sinusoids is periodic only when every ratio of their frequencies is a rational number. Sinusoids at 50 Hz and 60 Hz together repeat every 0.1 s, and within that period they are the fifth and sixth harmonics of 10 Hz. Sinusoids at 1 Hz and √2 Hz together never repeat. Components of a power-system waveform at frequencies that are not integer multiples of the line frequency are called interharmonics; Harmonics and Power Factor describes how they are measured.
Why Sinusoids
A stable linear time-invariant circuit driven by a sinusoid settles to a sinusoid of the same frequency, changed only in amplitude and phase. No other periodic waveform keeps its shape in general: a square wave comes out of an RC filter with rounded corners. Once a periodic input is written as a sum of sinusoids, phasor analysis, as developed in AC Circuit Analysis, handles each one, and superposition adds the results.
Orthogonality
Harmonics of different orders are orthogonal. Integrated over any interval of length T, and for positive integers m and n,
∫ cos(mω0t) cos(nω0t) dt = ∫ sin(mω0t) sin(nω0t) dt = 0 when m and n differ, and T/2 when m = n
∫ sin(mω0t) cos(nω0t) dt = 0 for all m and n
The integral of each sinusoid alone over a period is also zero. Multiplying a waveform by one harmonic and averaging therefore isolates that harmonic's coefficient, which is how the coefficient formulas below work and how a lock-in amplifier extracts one frequency from a noisy signal.
The Trigonometric Form
A periodic waveform f(t) with period T and fundamental ω0 = 2π/T has the Fourier series
f(t) = a0 + ∑n=1∞ [an cos(nω0t) + bn sin(nω0t)]
The coefficients are integrals over one period, where ∫T denotes any interval of length T, such as 0 to T or −T/2 to T/2; all give the same result.
a0 = (1/T) ∫T f(t) dt
an = (2/T) ∫T f(t) cos(nω0t) dt, for n = 1, 2, 3, …
bn = (2/T) ∫T f(t) sin(nω0t) dt, for n = 1, 2, 3, …
Each formula follows from orthogonality: multiplying the series by cos(mω0t) and integrating over a period removes every term except amT/2. The constant term uses 1/T rather than 2/T because the integral of 1 over a period is T, not T/2. The coefficients carry the units of f(t), and a0 is the average value, the reading of an ideal DC voltmeter.
Many mathematics texts instead write the constant term as a0/2 with a0 = (2/T) ∫T f(t) dt, so that one formula serves every an; their a0 is twice the average value. Check which convention a table uses before reading its DC term. This article uses the average-value convention throughout.
Amplitude and Phase Form
Each pair of terms combines into a single cosine:
f(t) = A0 + ∑n=1∞ An cos(nω0t + φn)
with A0 = a0, An = √(an2 + bn2), an = An cos φn, and bn = −An sin φn. The phase φn is the angle of the complex number an − jbn. The arctangent of −bn/an gives it directly only when an > 0; otherwise add or subtract 180°, a correction that the two-argument arctangent function of most programming languages makes automatically.
An is the peak amplitude of the nth harmonic, and its RMS value is An/√2. Plotted against frequency, the An form the amplitude spectrum and the φn form the phase spectrum. Delaying a waveform changes its phases but not its amplitudes, which is why published tables of harmonic amplitudes agree while tables of phases often do not. Some texts expand in sines, An sin(nω0t + θn), where θn = φn + 90°.
The Complex Exponential Form
Euler's formula, cos x = (ejx + e−jx)/2 and sin x = (ejx − e−jx)/(2j), splits each harmonic into complex exponentials at +nω0 and −nω0. The series becomes
f(t) = ∑n=−∞∞ cn ejnω0t
with a single coefficient formula for every integer n, including n = 0:
cn = (1/T) ∫T f(t) e−jnω0t dt
The two forms are related by c0 = a0, cn = (an − jbn)/2, and c−n = (an + jbn)/2 for n ≥ 1; in reverse, an = 2 Re(cn) and bn = −2 Im(cn). For a real waveform, c−n is the complex conjugate of cn, |cn| = An/2, and the angle of cn is φn. The exponential form is usually quicker to integrate and matches the Fourier transform and the discrete Fourier transform used by instruments.
One-Sided and Two-Sided Spectra
The exponential form places a line of height |cn| at both +nf0 and −nf0, a two-sided spectrum; the negative frequencies are bookkeeping, since the two exponentials together make one real cosine. A one-sided spectrum folds each pair into a single line of height An = 2|cn|. Before comparing a plot with a table, check whether it shows |cn|, the peak amplitude An, or the RMS value An/√2; they differ by factors of 2 and √2, or 6.02 dB and 3.01 dB.
Properties of the Coefficients
In the table, f(t) and g(t) share the period T and have coefficients cn and dn.
| Property | Waveform | Coefficients |
|---|---|---|
| Linearity | αf(t) + βg(t) | αcn + βdn |
| Adding a constant K | f(t) + K | c0 + K; all others unchanged |
| Time shift | f(t − td) | cne−jnω0td |
| Time reversal | f(−t) | c−n |
| Time scaling, α > 0 | f(αt) | cn, at the new fundamental αω0 |
| Differentiation | df/dt | jnω0cn |
| Integration, when c0 = 0 | ∫0t f(u) du | cn/(jnω0) for every nonzero n; the DC term is the average of the integral |
| Multiplication by a harmonic | f(t)ejkω0t | cn−k |
| Product of two waveforms | f(t)g(t) | ∑k ckdn−k |
Differentiation emphasizes high harmonics, and where f(t) jumps, the derivative contains impulses, which the rule includes. Integration needs a zero average, because a nonzero average integrates to a ramp, which is not periodic.
These rules save integration. The even triangle wave with peaks of ±A, equal to +A at t = 0, falls with slope −4A/T for 0 < t < T/2 and rises with slope +4A/T for the next half-period, so its derivative is the square wave of the next section's worked example with a height of B = −4A/T, whose coefficients for odd n are cn = −j2B/(nπ). Dividing them by jnω0 gives the triangle wave's coefficients, cn = 4A/(n2π2) for odd n, so an = 8A/(n2π2), without a second integration.
Computing the Coefficients
A Procedure
- Sketch one period, read the period T, and write ω0 = 2π/T.
- Choose a time origin that makes the waveform simple, preferably one that gives it even or odd symmetry.
- Write f(t) piecewise over one period.
- Find a0, the area under one period divided by T, often by inspection.
- Use symmetry to identify the coefficients that vanish, and integrate the rest. Ramps need integration by parts: ∫ t cos(kt) dt = cos(kt)/k2 + t sin(kt)/k and ∫ t sin(kt) dt = sin(kt)/k2 − t cos(kt)/k.
- Simplify with sin(nπ) = 0 and cos(nπ) = (−1)n, which usually splits the result into separate expressions for odd and even n.
- Check the result: the DC term against the average, a partial sum against the sketch at one or two instants, and the sum of the squared coefficients against the RMS value by Parseval's theorem.
Worked Example: Square Wave
Take f(t) = +A for 0 < t < T/2 and f(t) = −A for T/2 < t < T.
- The average is zero, so a0 = 0. The waveform is odd, so every an = 0.
- Integrate over 0 to T: bn = (2/T)[∫0T/2 A sin(nω0t) dt − ∫T/2T A sin(nω0t) dt].
- The first integral is A[1 − cos(nπ)]/(nω0) and the second is A[cos(nπ) − 1]/(nω0), because nω0T/2 = nπ.
- Since ω0T = 2π, bn = [2A/(nπ)][1 − (−1)n], which is 4A/(nπ) for odd n and 0 for even n.
The result is
f(t) = (4A/π)[sin(ω0t) + (1/3) sin(3ω0t) + (1/5) sin(5ω0t) + …]
At t = T/4 every sine is ±1 and the bracket becomes 1 − 1/3 + 1/5 − 1/7 + …, which sums to π/4, so the series gives A, as it should. In exponential form, cn = −j2A/(nπ) for odd n.
Worked Example: Sawtooth
Take f(t) = 2At/T for −T/2 < t < T/2, a ramp from −A to +A that drops back at the end of each period.
- The waveform is odd, so a0 = 0 and every an = 0.
- By odd symmetry, bn = (4/T) ∫0T/2 (2At/T) sin(nω0t) dt = (8A/T2)[sin(nω0t)/(nω0)2 − t cos(nω0t)/(nω0)], evaluated from 0 to T/2.
- At t = T/2 the sine is zero and the cosine is (−1)n, and (T/2)/(nω0) = T2/(4nπ), so the bracket equals −T2(−1)n/(4nπ). At t = 0 it is zero.
- Therefore bn = 2A(−1)n+1/(nπ).
f(t) = (2A/π)[sin(ω0t) − (1/2) sin(2ω0t) + (1/3) sin(3ω0t) − …]
Symmetry Shortcuts
Symmetry shows in advance which coefficients vanish, and it halves or quarters the interval that must be integrated.
| Symmetry | Condition | Coefficients that vanish | Remaining coefficients |
|---|---|---|---|
| Even | f(−t) = f(t) | Every bn | a0 = (2/T) ∫0T/2 f(t) dt and an = (4/T) ∫0T/2 f(t) cos(nω0t) dt |
| Odd | f(−t) = −f(t) | a0 and every an | bn = (4/T) ∫0T/2 f(t) sin(nω0t) dt |
| Half-wave | f(t + T/2) = −f(t) | a0 and every even harmonic | For odd n, an and bn from (4/T) ∫0T/2 with cos(nω0t) or sin(nω0t) |
| Even quarter-wave | Even and half-wave | a0, every bn, and every even an | For odd n, an = (8/T) ∫0T/4 f(t) cos(nω0t) dt |
| Odd quarter-wave | Odd and half-wave | a0, every an, and every even bn | For odd n, bn = (8/T) ∫0T/4 f(t) sin(nω0t) dt |
The half-wave rule follows from substituting t = u + T/2 in the second half of the integral. That half then contributes (−1)n+1 times the first half, so the halves cancel for even n and add for odd n.
Hidden Symmetry and the Time Origin
Even and odd symmetry depend on where t = 0 sits; half-wave symmetry does not, because it compares the waveform with itself half a period later. The odd square wave of the previous section, advanced by T/4, becomes even:
f(t) = (4A/π)[cos(ω0t) − (1/3) cos(3ω0t) + (1/5) cos(5ω0t) − …]
A DC offset hides symmetry in the same way: a square wave between 0 and V is V/2 plus a square wave of ±V/2, so it has a DC term of V/2 and odd harmonics of 2V/(nπ). Subtract the average before looking for symmetry.
Symmetry in Circuits
A sinusoid has half-wave symmetry, and a time-invariant circuit that answers an inverted input with an exactly inverted output preserves it however nonlinear the circuit is, so its steady-state output contains only odd harmonics. Symmetric clipping by back-to-back diodes, a balanced push-pull stage, and the magnetizing current of a core with a symmetric B-H loop all distort this way. Any asymmetry, such as half-wave rectification, one-sided clipping, a mismatched push-pull pair, or DC bias in a core, adds even harmonics and usually a DC shift, so a second harmonic in a supposedly symmetric system points to an imbalance. In a four-wire three-phase system with balanced nonlinear loads, harmonics whose order is a multiple of three add in the neutral instead of canceling, as Three-Phase Circuits and Power explains.
Spectra of Common Waveforms
In the table, A is the peak value, T is the period, and ω0 = 2π/T. Each entry states the time origin that its phases assume.
| Waveform and time origin | Fourier series | DC and RMS values |
|---|---|---|
| Square wave of ±A, +A for 0 < t < T/2 (odd) | (4A/π) ∑n odd (1/n) sin(nω0t) | DC 0; RMS A |
| Triangle wave of ±A, +A at t = 0 (even) | (8A/π2) ∑n odd (1/n2) cos(nω0t) | DC 0; RMS A/√3 |
| Sawtooth of ±A, 2At/T for −T/2 < t < T/2 (odd) | (2A/π) ∑n=1∞ [(−1)n+1/n] sin(nω0t) | DC 0; RMS A/√3 |
| Ramp from 0 to A, At/T for 0 < t < T | A/2 − (A/π) ∑n=1∞ (1/n) sin(nω0t) | DC A/2; RMS A/√3 |
| Pulse train of height A and width τ, centered on t = 0, duty cycle D = τ/T (even) | AD + (2A/π) ∑n=1∞ (1/n) sin(nπD) cos(nω0t) | DC AD; RMS A√D |
| Half-wave rectified sine of peak A, A sin ω0t for 0 < t < T/2 and 0 otherwise | A/π + (A/2) sin ω0t − (2A/π) ∑n=2,4,6,… cos(nω0t)/(n2 − 1) | DC A/π; RMS A/2 |
| Full-wave rectified sine of peak A, |A sin ω0t|, with ω0 the source frequency | 2A/π − (4A/π) ∑n=2,4,6,… cos(nω0t)/(n2 − 1) | DC 2A/π; RMS A/√2 |
Square and Triangle Waves
Both waves have half-wave symmetry, so both contain only odd harmonics. The square wave's harmonics fall as 1/n, which puts the third and fifth 9.54 dB and 13.98 dB below the fundamental; the triangle wave's fall as 1/n2, which puts them 19.08 dB and 27.96 dB below. The fundamental carries 81.1 percent of a square wave's mean-square value but 98.6 percent of a triangle wave's. The square wave's fundamental, 4A/π ≈ 1.273A, exceeds the wave's own peak, so a filter that keeps only the fundamental turns a ±5 V square wave into a sine wave of 6.37 V peak.
Sawtooth Waves
A sawtooth has no half-wave symmetry, so it contains every harmonic, with amplitudes falling as 1/n and, in the odd form of the table, alternating in sign. The ramp from 0 to A equals a DC term of A/2 plus a sawtooth of ±A/2 delayed by half a period, so its harmonics have amplitudes of A/(nπ). The ramp carriers of pulse-width modulators and the sweeps of timebase circuits have this spectrum.
Pulse Trains and Duty Cycle
For the pulse train in the table, the exponential coefficients are cn = AD sinc(nD), where sinc(x) = sin(πx)/(πx); some texts define sinc without the factors of π. The lines are spaced f0 = 1/T apart, but the shape of their envelope depends only on the pulse width: it is 3 dB down near 0.443/τ and zero at every multiple of 1/τ, so a narrower pulse spreads its energy over more harmonics. At D = 0.25, every fourth harmonic vanishes. Duty cycles of D and 1 − D give the same harmonic amplitudes, because a pulse train and its complement differ only in sign and DC level.
| Harmonic | Square | Triangle | Sawtooth | Pulse train, D = 0.25 |
|---|---|---|---|---|
| 2 | 0 | 0 | 50.0 | 70.7 |
| 3 | 33.3 | 11.1 | 33.3 | 33.3 |
| 4 | 0 | 0 | 25.0 | 0 |
| 5 | 20.0 | 4.0 | 20.0 | 20.0 |
| 6 | 0 | 0 | 16.7 | 23.6 |
| 7 | 14.3 | 2.0 | 14.3 | 14.3 |
| 8 | 0 | 0 | 12.5 | 0 |
| 9 | 11.1 | 1.2 | 11.1 | 11.1 |
Real pulses have finite edges. For a trapezoidal pulse train with equal rise and fall times tr, each measured from 0 to 100 percent, and a width τ measured at half height, cn = AD sinc(nD) sinc(ntr/T). The envelope of the one-sided amplitudes is flat up to 1/(πτ), falls at 20 dB per decade up to 1/(πtr), and falls at 40 dB per decade beyond. Slower edges therefore cut the upper spectrum, which is the basis of the edge-rate control described in Radiated Emission Sources.
Rectified Sine Waves
The half-wave rectified sine has a DC value of 0.318A, a component of 0.5A at the source frequency, and even harmonics of 0.212A, 0.042A, and 0.018A at two, four, and six times the source frequency, but no odd harmonics above the fundamental. The full-wave rectified sine repeats twice per source cycle, so the table indexes its lines to the source frequency: 0.637A of DC, then 0.424A, 0.085A, and 0.036A at two, four, and six times the source frequency. Both spectra fall as 1/n2, because both waveforms are continuous with abrupt changes of slope. The ripple factor, the ratio of the RMS ripple to the DC value, is 1.21 for half-wave and 0.483 for full-wave rectification.
For filter design, a full-wave rectifier on a 60 Hz line leaves its largest ripple component at 120 Hz, while a half-wave rectifier leaves a larger one at 60 Hz. These spectra assume ideal diodes and a resistive load with no smoothing capacitor. With a capacitor, the diodes conduct in short pulses, and the line current becomes a pulse train with a different spectrum.
Parseval's Theorem and RMS Values
For a periodic waveform with a finite RMS value, Parseval's theorem states that
(1/T) ∫T f(t)2 dt = a02 + ½ ∑n=1∞ (an2 + bn2) = ∑n=−∞∞ |cn|2
The left side is the mean-square value, the square of the RMS value. Squaring the series produces products of harmonics of different orders, and orthogonality makes each of those products average to zero, leaving only the squares. The theorem is named for Marc-Antoine Parseval, whose memoir on series is dated 5 April 1799 and was published in 1806.
RMS Value from Harmonics
With F0 = a0 for the DC value and Fn = An/√2 for the RMS value of the nth harmonic, the theorem becomes
Frms = √(F02 + F12 + F22 + F32 + …)
The RMS values of components at different frequencies combine as the square root of the sum of their squares, never arithmetically, whatever their phases. Phase does change the peak value, so two waveforms with the same harmonic amplitudes share an RMS value but can have different crest factors. A current with a fundamental of 10 A RMS, a fifth harmonic of 2 A, and a seventh harmonic of 1.4 A has an RMS value of √(100 + 4 + 1.96) A = 10.29 A.
The square wave checks the theorem. Its mean-square value is A2, and the series requires A2 = ½ ∑ [4A/(nπ)]2 over odd n, which holds because the sum of 1/n2 over odd n is π2/8. The fundamental alone supplies 8/π2, or 81.1 percent, of the mean-square value; harmonics through the ninth bring the total to 96.0 percent, and harmonics through the 99th to 99.6 percent.
An average-responding meter scales the rectified average by 1.111, the ratio of RMS value to rectified average that holds for a sine wave, so it reads a square wave 11 percent high and a triangle wave 3.8 percent low. A true-RMS meter reads both correctly.
Power Carried by Harmonics
When a voltage and a current share the same fundamental period, the average power is
P = V0I0 + ∑n=1∞ VnIn cos θn
where Vn and In are the RMS values of the nth harmonics and θn is the phase angle between them. By orthogonality, a voltage harmonic and a current harmonic of different orders deliver no average power. In a resistor every harmonic pair is in phase and P = Frms2/R: the ±5 V square wave across 10 Ω dissipates 2.5 W, of which the fundamental, 4.50 V RMS, supplies 2.03 W. When the supply voltage is a pure sinusoid, only the fundamental current delivers average power, and harmonic currents add RMS current and losses without adding power. That is the origin of distortion power factor, which Harmonics and Power Factor treats.
Total Harmonic Distortion
Total harmonic distortion (THD) condenses a spectrum into one number that says how far a waveform departs from a pure sinusoid at its fundamental frequency. Two definitions are in use. For a waveform with no DC component, with Fn the RMS value of the nth harmonic,
THDF = √(F22 + F32 + F42 + …)/F1
refers the harmonic content to the fundamental, and
THDR = √(F22 + F32 + F42 + …)/Frms
refers it to the total RMS value, fundamental included. Because Frms2 is F12 plus the sum of the squared harmonics, the two convert exactly:
THDR = THDF/√(1 + THDF2) and THDF = THDR/√(1 − THDR2)
At low distortion the two agree closely: a THDF of 5 percent is a THDR of 4.99 percent. They part company as distortion grows. A square wave has a THDF of 48.3 percent but a THDR of 43.5 percent, and a current with a THDF of 150 percent has a THDR of 83.2 percent. THDR can never exceed 100 percent, while THDF has no upper limit, so a current THD above 100 percent, which heavily distorting loads can reach, is necessarily a THDF figure. This article means THDF whenever it writes THD without a subscript.
IEEE Std 519-2014 defined THD relative to the fundamental, counting harmonic components through the 50th order, or higher when necessary, and excluding interharmonics. It defined total demand distortion (TDD) the same way but relative to the maximum demand current. IEEE 519-2022 has since superseded that edition. The analyzer maker Power Monitors, Inc., which labels the two forms THD-F and THD-R, recommends THD-F for power systems and notes that THD-R was adopted from audio amplifier measurement. A stated THD also depends on how many harmonics it counts: for a square wave, stopping at the 50th harmonic gives 47.3 percent rather than 48.3 percent.
| Waveform | RMS value | Fundamental RMS value | THDF (percent) | THDR (percent) |
|---|---|---|---|---|
| Square wave of ±A | A | 0.900A | 48.3 | 43.5 |
| Triangle wave of ±A | 0.577A | 0.573A | 12.1 | 12.0 |
| Sawtooth of ±A | 0.577A | 0.450A | 80.3 | 62.6 |
| Quasi-square wave of ±A with β = 30°, described under switching waveforms | 0.816A | 0.780A | 31.1 | 29.7 |
By Parseval's theorem, the first three THDF values are √(π2/8 − 1), √(π4/96 − 1), and √(π2/6 − 1).
Convergence and the Gibbs Phenomenon
Dirichlet Conditions
The coefficients exist whenever |f(t)| has a finite integral over a period, but whether the partial sums approach the waveform is a separate question. The Dirichlet conditions answer it for practical waveforms. Suppose that over one period the waveform
- is absolutely integrable, so that ∫T |f(t)| dt is finite;
- has a finite number of maxima and minima; and
- has a finite number of discontinuities, each a finite jump.
Then the series converges to f(t) wherever the waveform is continuous, and to the midpoint of the jump, [f(t−) + f(t+)]/2, at each discontinuity. The square wave's series gives exactly 0 at t = 0 and t = T/2, halfway between −A and +A. The conditions are sufficient but not necessary, and the waveforms met in circuit work satisfy them.
Kinds of Convergence
For any waveform with a finite RMS value, the series converges in mean square: the RMS value of the error between the waveform and its partial sum through harmonic N tends to zero as N grows. By Parseval's theorem, the mean square of that error is the sum of the omitted |cn|2. No other sum of sinusoids through harmonic N has a smaller RMS error, so the truncated series is the best least-squares fit of its order.
If the waveform is continuous and its derivative is piecewise continuous, as for a triangle wave or a rectified sine, the convergence is uniform: the largest error anywhere in the period shrinks to zero. Continuity alone does not guarantee convergence at every instant, since continuous functions exist whose series diverge at a point, but such functions do not arise in circuit analysis.
Smoothness and the Rate of Decay
The smoother the waveform, the faster its coefficients fall. Jumps give coefficients that fall as 1/n, as in the square wave, sawtooth, and pulse train; a continuous waveform whose slope jumps gives 1/n2, as in the triangle wave and the rectified sines. In general, when f(t) and its first k − 1 derivatives are continuous and the kth derivative jumps, the coefficients fall as 1/nk+1. On a logarithmic plot these envelopes fall at 20 dB and 40 dB per decade, the two slopes of the trapezoidal pulse envelope.
The Gibbs Phenomenon
Near a jump, every partial sum overshoots, and the overshoot does not shrink as harmonics are added. It narrows and moves toward the jump, but its height approaches a fixed fraction of the jump,
(1/π) ∫0π (sin x)/x dx − ½ ≈ 0.0895
or 8.95 percent, above the upper level on one side of the jump and below the lower level on the other. A ±A square wave jumps by 2A, so its partial sums peak near 1.179A. For odd N, the first peak of the square-wave sum through harmonic N lies at t = T/[2(N + 1)] after the jump, and an undershoot to about 0.903A follows at twice that time. The table shows the peak holding its height as it moves in, while the RMS error keeps falling.
| N | Peak location (fraction of T) | Peak value | Overshoot (percent of jump) | RMS error |
|---|---|---|---|---|
| 9 | 0.0500 | 1.1823 | 9.12 | 0.201 |
| 19 | 0.0250 | 1.1798 | 8.99 | 0.142 |
| 49 | 0.0100 | 1.1791 | 8.96 | 0.090 |
| 99 | 0.0050 | 1.1790 | 8.95 | 0.064 |
| 999 | 0.0005 | 1.1790 | 8.95 | 0.020 |
Henry Wilbraham analyzed the overshoot in 1848, in The Cambridge and Dublin Mathematical Journal. J. Willard Gibbs missed it in a note of 1898 and described it in a correction that Nature published on 27 April 1899, and Maxime Bôcher named it the Gibbs phenomenon in a detailed analysis in 1906.
Tapering the coefficients trades overshoot for a slower edge: with the Lanczos sigma factors, sinc[n/(N + 1)], the square wave's overshoot falls to about 1.2 percent of the jump, and with Fejér's weights, 1 − n/(N + 1), it disappears.
Where the Overshoot Appears
An ideal low-pass filter with a brick-wall cutoff passes a finite set of harmonics unchanged and removes the rest, so its response to a square wave is exactly a partial sum, with the full 9 percent overshoot however high the cutoff. Filters with gradual roll-offs taper the harmonics and overshoot less; a Gaussian response does not overshoot at all, and the Bessel filters that approximate it overshoot only slightly. Designing a finite impulse response filter by truncating an ideal impulse response is a Fourier series in frequency, so the ripple beside each band edge stays near 9 percent of the step in gain however many coefficients are used. That limits a rectangular-window design to about 21 dB of stopband attenuation, since 20 log10 0.0895 = −21.0 dB, which is why the window-based designs described in Digital Filter Implementation favor tapered windows. Overshoot seen on an oscilloscope usually has another cause, such as probe ground-lead resonance or an underdamped amplifier; Gibbs ringing requires a sharp truncation of the spectrum.
Response of Linear Circuits to Periodic Inputs
Suppose a stable linear time-invariant circuit with frequency response H(jω) is driven by the periodic input f(t) = ∑ cnejnω0t. Once the transients that follow switch-on have decayed, its output is
y(t) = ∑n=−∞∞ H(jnω0) cn ejnω0t = H(0)A0 + ∑n=1∞ |H(jnω0)| An cos(nω0t + φn + θn)
where θn is the angle of H(jnω0). The output has the period of the input, but each harmonic is scaled and shifted separately, so the harmonic mix changes. The result describes steady state only; the Laplace transform finds the complete response, transient included.
- Expand the input in a Fourier series and decide how many harmonics matter.
- For each harmonic n, solve the phasor circuit with every impedance evaluated at nω0: jnω0L for an inductor and 1/(jnω0C) for a capacitor. For the DC term, a capacitor is an open circuit and an inductor a short circuit.
- Convert each result back to a sinusoid and add the sinusoids in the time domain. Never add phasors that belong to different frequencies.
- Find RMS values and power harmonic by harmonic with Parseval's theorem.
Worked Example: Square Wave into an RC Low-Pass Filter
A ±5 V, 1 kHz square wave drives an unloaded RC low-pass filter whose corner frequency, fc = 1/(2πRC), is also 1 kHz. Values of R = 1.59 kΩ and C = 100 nF give 1.001 kHz; the calculation uses exactly 1 kHz. The response is H(jω) = 1/(1 + jω/ωc), so at harmonic n the gain magnitude is 1/√(1 + n2) and the phase shift is −arctan n.
| Harmonic | Input amplitude (V) | Gain magnitude | Phase shift | Output amplitude (V) |
|---|---|---|---|---|
| 1 | 6.366 | 0.707 | −45.0° | 4.502 |
| 3 | 2.122 | 0.316 | −71.6° | 0.671 |
| 5 | 1.273 | 0.196 | −78.7° | 0.250 |
| 7 | 0.909 | 0.141 | −81.9° | 0.129 |
| 9 | 0.707 | 0.110 | −83.7° | 0.078 |
The input harmonics fall as 1/n, and above its corner the filter contributes nearly another factor of 1/n, so the output harmonics fall almost as 1/n2. The output fundamental has an RMS value of 3.183 V, and summing every harmonic by Parseval's theorem gives an output RMS value of 3.225 V, so the output THD is 16.4 percent, down from 48.3 percent at the input.
A time-domain solution checks the result. In steady state each half-cycle charges the capacitor exponentially from one peak toward the opposite supply level, and symmetry gives a peak of Vp = 5 tanh[T/(4RC)] V = 5 tanh(π/2) V = 4.586 V at the end of each half-cycle. The Fourier sum approaches that peak slowly: 3.18 V from the fundamental alone, 4.27 V through the ninth harmonic, and 4.55 V through the 99th. The exact waveform's RMS value is 3.225 V, as the harmonic sum predicted. RMS values converge quickly, but sharp corners need many terms, so the question should decide the method.
Tuned Circuits Select Harmonics
A resonant circuit does the opposite: it passes one harmonic and rejects the rest. A series RLC band-pass filter with its output across the resistor, tuned to 3 kHz with a quality factor Q of 10, has the gain |H| = 1/√[1 + Q2(f/fr − fr/f)2], which is 0.0375 at 1 kHz and 0.0933 at 5 kHz. Driven by the same square wave, whose fundamental is three times its third harmonic, it delivers a 1 kHz component of 11.2 percent and a 5 kHz component of 5.6 percent of the 3 kHz output, and all the unwanted components together total 12.9 percent. Frequency multipliers work this way, and so does the tank circuit that restores a sinusoid from the current pulses of a class C stage, described in Power Amplifiers.
When Superposition Fails
Harmonic-by-harmonic analysis requires linearity. A diode, a saturating transistor, or a magnetic core creates frequencies the input did not contain. Simulators find the periodic steady state of such circuits by harmonic balance, which represents voltages and currents as Fourier series with unknown coefficients, as RF and Microwave Design Software describes.
Line Spectra and the Fourier Transform
From Series to Transform
A periodic waveform has a line spectrum, with energy only at DC and at multiples of f0. A single pulse, which never repeats, has a continuous spectrum given by the Fourier transform,
F(jω) = ∫−∞∞ f(t) e−jωt dt
If f1(t) equals a periodic waveform over one period and is zero elsewhere, comparing this integral with the coefficient formula gives
cn = (1/T) F1(jnω0)
The lines are samples of the transform of one period, taken every ω0 and scaled by 1/T. A rectangular pulse of height A and width τ centered on t = 0 has F1(jω) = Aτ sin(ωτ/2)/(ωτ/2), and sampling it at ω = nω0 gives back cn = AD sinc(nD). Lengthening T with τ fixed crowds the lines together and shrinks them in proportion to 1/T while their envelope keeps its shape; in the limit, Tcn becomes the continuous transform. Conversely, the Fourier transform of a periodic waveform is a set of impulses, F(jω) = 2π ∑ cnδ(ω − nω0). The Laplace Transform article relates the transform to s = jω, and the Z-Transform article treats the discrete-time Fourier transform of sampled signals.
Line Spectra in Measurement
Instruments compute spectra from samples, usually with the fast Fourier transform described in Transform Processing. Suppose N equally spaced samples x[i] span exactly M periods of a waveform that has no harmonic at or above half the sampling rate. The discrete Fourier transform
X[k] = ∑i=0N−1 x[i] e−j2πki/N
then gives the coefficients exactly: X[Mn]/N = cn, so the amplitude of harmonic n is An = 2|X[Mn]|/N. Two conditions often fail in practice.
- When the record does not hold a whole number of periods, each line leaks into neighboring bins. A sine wave that starts at zero phase and completes 2.5 cycles in a 64-sample record shows its two largest bins at 0.71 and 0.58 of its true amplitude and spreads smaller amounts into every other bin. Window functions reduce the leakage, and power-quality analyzers avoid it by synchronizing their measurement windows to whole line cycles.
- A waveform with jumps has harmonics without end, so some always lie above half the sampling rate and alias onto lower lines. Sampling one period of a square wave as 32 samples at +A and 32 at −A reads its fundamental 0.04 percent high and its third harmonic 0.4 percent high.
Switching and PWM Waveforms
Switching circuits build their waveforms from rectangles, so their spectra follow from the square-wave and pulse-train results.
Square-Wave and Quasi-Square-Wave Inverters
A full bridge that switches its output between +Vdc and −Vdc as a square wave produces a fundamental of 4Vdc/π peak, 1.27 times the DC input, with every odd harmonic at 1/n of the fundamental and a THD of 48.3 percent. Delaying the switching of one leg relative to the other inserts a zero-voltage interval of 2β centered on each zero crossing. The resulting quasi-square wave has odd quarter-wave symmetry, and the quarter-period integral from the symmetry table gives
bn = [4Vdc/(nπ)] cos(nβ), for odd n
Choosing β = 30° makes cos 3β zero, which removes the third harmonic and every other harmonic whose order is a multiple of three. The fundamental falls only to cos 30°, or 86.6 percent of the square wave's, and the THD falls to 31.1 percent. Selective harmonic elimination extends the idea: each additional switching angle per quarter-cycle can cancel one more harmonic order. DC-AC Conversion (Inversion) describes the inverter circuits.
Pulse-Width Modulation
In continuous conduction, the switch node of a buck converter is a pulse train between 0 and Vin at the switching frequency fsw. Its DC term, DVin, is the output voltage of an ideal buck converter, and its harmonics lie at multiples of fsw with amplitudes of [2Vin/(nπ)]|sin(nπD)|. The output LC filter keeps the DC term and, well above its corner frequency fc, attenuates each line by a factor of about (nfsw/fc)2. With Vin = 12 V, D = 0.25, fsw = 500 kHz, and fc = 10 kHz, the first switching harmonic, 5.40 V peak, falls to 2.16 mV, and the second contributes 0.38 mV. The complete harmonic sum gives a peak-to-peak ripple of 4.44 mV, matching the time-domain formula (1 − D)Vout/(8LCfsw2). Both calculations assume an ideal filter with no load damping and a capacitor with no equivalent series resistance, whose contribution can dominate real ripple.
An inverter leg that switches between ±Vdc/2 by comparing a sinusoidal reference at f1 with a triangular carrier at mff1 produces a fundamental of maVdc/2 peak for ma ≤ 1, where the modulation index ma is the ratio of the reference peak to the carrier peak. The switching harmonics cluster at and around multiples of the carrier frequency rather than near the fundamental. A numerical Fourier analysis of this waveform with ma = 0.8 and mf = 21 gives, in units of Vdc/2, 0.818 at the 21st harmonic, 0.220 at the 19th and 23rd, and 0.314 at the 41st and 43rd, while every harmonic from the 2nd through the 17th stays below 0.01. An output filter, or the inductance of a motor winding, can therefore attenuate the switching components while passing the fundamental. Randomizing the switching frequency spreads the lines into a continuous spectrum, as PWM Generation describes.
Summary
A Fourier series expresses a periodic waveform as a DC term plus harmonics at whole multiples of its fundamental frequency, each coefficient an integral over one period. Symmetry shows which coefficients vanish, and spectra fall as 1/n for waveforms with jumps and as 1/n2 for waveforms with kinks. Parseval's theorem gives RMS values and power harmonic by harmonic and underlies both definitions of THD, whose convention should always be stated. Partial sums converge in mean square but overshoot each jump by about 9 percent of its height. A linear circuit scales and shifts each harmonic independently, which makes filter, ripple, and switching-spectrum calculations routine, and the Fourier transform extends the same ideas to single pulses and sampled records.