Fourier analysis of the SQUARE WAVE


The Problem

Let f(x) = {1 if -p<x<0, 0 if 0<x<p, and periodic of period 2p}. This function is a square wave; a plot shows the value 1 from x=p to x = 0 followed by the value 0 from x = 0 to x=p and the shape repeats in each interval of length 2p. The problem is to find the coefficients for the Fourier expansion of the square wave.

The Solution

The Fourier coefficients are found by integration:
a0 = 1,
an>0 = 0, cosine terms are absent,
bn = {0 if n is even and -2/np if n is odd} (only odd sine terms are present).

The Fourier expansion, through n=2m+1 is
F(m,x) = 1/2 - 2/p[sin(x) + 1/3 sin(3x) + 1/5 sin(5x) + ... + 1/(2m+1) sin((2m+1)x)].
The following plot illustrates the expansion.

 wpe2B.gif (3767 bytes)


Fourier expansion of the square wave. The function f(x) is defined to be f(-p<x<0) = 0 and f(0<x<p)=0 and it is periodic f(x+2p) = f(x). Two Fourier expansions are shown. The two-term expansion,  F(1,x) = 1/2 - 0.637 sin(x) is a pure fundamental of frequency 2p shifted upward by the constant 1/2. A much closer approximation is the 7-term series, 1/2 - 0.637sin(x)-0.212sin(3x)-0.127sin(5x)-0.091sin(7x)
-0.071sin(9x)-0.058sin(11x), containing 5 odd harmonics with diminishing amplitudes.