Two previous posts began the discussion of using the Fourier series to break down a periodic signal into constituent sine/cosine waves. Now, to finish that up, we can look at a general case that varies both the phase and the duty cycle of the example square wave. Recall from last time that shifting a square wave by an arbitrary amount would move energy between the constituent cosines and sines, but that we never saw any energy in the even harmonics. The reason for this becomes clear if instead of looking at the Fourier series, we look at the Fourier Transform and employ a couple useful identities.

We use the Fourier Transform to convert a signal between two domains, say time and frequency—although you also often use space and spatial frequency in optics. In this way, it is a generalized form of the Fourier series we have been discussing. The Fourier series breaks down periodic functions into sines and cosines of various frequencies and amplitudes. The Fourier Transform does the same thing for arbitrary signals resulting in amplitudes as a function of frequency.

The two processes also use the same basis although the Fourier transform is often written to use complex exponentials, and the resulting function represents complex amplitudes. But this is just the same thing as the Fourier series! A complex exponential can be written as:

$$ e^{j \theta} = \cos \theta + j \sin \theta $$

…so we can equivalently say that the *a* coefficients—on the cosine terms—of the Fourier series represent the same thing as the real part of the
Fourier transform, and the *b* coefficients represent the imaginary part.

Back to the square wave. But instead of a square wave, let’s think of this as a combination of three functions. Looking at one period, we have a square pulse, a.k.a. a rect function. A rect function typically ranges from 0 to 1, so the rect is scaled by 2x and it is shifted down. That constant shift is the second function. And finally, the pulse happens periodically, so we can write this as a convolution (lower case) with a Dirac comb, a series of delta functions, infinitesimally thin spikes. Convolving a function with a comb basically makes a copy of the function at each tooth of the comb.

The next figure illustrates this for our square wave. The square wave is in grey; two times the rect (with a width, w, of pi) is in blue; the Dirac comb (with a period, T, of 2 pi) is in red; and the constant offset of -1 is in green.

We can write the function as:

$$ y(t) = 2 \text{rect}\left(\frac{t}{w}\right) \ast \Delta_T(t) - 1 $$

and using some rules of Fourier transforms—and a table of transforms—we can easily write the function’s transform. First, the constant becomes a delta function—one component of a comb—at zero and pointing down because it is negative 1. The rect becomes a sinc function which is a sine divided by its argument, and the argument is given by the width, w, of the rect. The comb becomes a comb with a spacing of 1/T instead of T. For the operators, addition and scaling stay the same, but the convolution becomes multiplication. This—with the rest of the details filled in—gives:

$$ Y(f) = 2 \frac{w \sin(\pi w f)}{\pi w f} \times \frac{\Delta_{1/T}(f)}{T} - \delta(f) $$

These constituents are shown in the top half of the next figure. The sinc (multiplied by 2 and divided by T) is in blue; the comb—not divided by T because we divided the sinc by T for visibility—in red; and the solitary delta function in green. The lower half of the figure shows everything put together. Notice how the resulting function is only non-zero where it coincides with the comb and that the sinc (in grey) represents an amplitude envelope.

Also notice that every other piece of the comb sits at the same frequency as the zero-crossings of the sinc. This explains why we only saw odd harmonics before. The zeros of the sinc sit where the argument of the sine is a multiple of pi or, in this example, with a spacing of 1/w. Because we have a 50% duty-cycle, w is half the period, T, so the zero spacing is 2/T. This is twice the spacing of the comb, so every other harmonic coincides with a zero of the envelope.

Finally, note that the combination of the sinc, comb, and solitary delta at frequency 0 is zero. f=0 represents a constant, or average value—a DC offset if you’re an electrical engineer. Because of the 50% duty cycle, the average value of our square wave is Y(0)=0.

Now let’s wrap up with a picture of what happens when the duty cycle is not 50% and we have an arbitrary shift in the square wave. We’ll have a
non-zero average value, and we’ll have a non-zero values for all of the *a* and *b* coefficients of the of the Fourier series.

The top half of the plot shows the square wave (black), the sum of the first ten harmonics (blue), and the sums of the first several odd and even harmonics (green and red). The lower half shows the frequency space representation with the amplitudes of the cosine and sine coefficients—or equivalently the real and imaginary parts of the Fourier transform. (The relative amplitudes of the real and imaginary parts are controlled by time-shifting the wave: a time shift is the same as convolving with a single delta function positioned away from t=0, and this is the same as multiplying by a complex exponential—a pure phase term—in the frequency domain.)

So that was kind of a long road over three posts, and it may not seem very practical yet. But understanding transitions between time and frequency and basic Fourier transform properties—especially the convolution-multiplication duality—are fundamental to countless engineering problems in analog and digital signal processing, wireless communication, and optics. (Lenses can do Fourier transforms in space). An upcoming post will look at how understanding these principles helped us find the source of unwanted emissions from a motor drive circuit, so stick around for that.