# Pulse Waveforms and Harmonics

Recently on a Q&A forum, I answered some questions about pulse waveforms and harmonics.  This might be of interest to others, especially students in digital media or non-technical fields who need to have an idea about this math and related jargon.

In most fields of study, the duty cycle is the fraction of the whole period taken up by the high segment, often given as percentage.  A square wave is 50%.   A skinny spikey pulse might be 1%.    At least that’s how EEs and physicists talk, usually.

One could give the ratio of the high segment duration to the low segment. For this example I quickly drew up, the pulse width is 30 time units (nanoseconds, seconds, minutes, years, whatever), the gap between the pulses, where the signal is low, measures 60 time units, and the period of the signal is 90, the sum of those.    Note that the period is measured from the leading edge of one pulse to the leading edge of the next. We could measure trailing edge to trailing edge just as well, or from the center of a pulse to the center of the next.  Like studs in the wall of a house, one must be careful to specify and measure center-to-center, not the facing surface-to-surface air gaps between the pieces of lumber.

Pulse with 1/3 duty cycle.

The time units are arbitrary, but we could say those are milliseconds.  A 90 ms period is the same as a frequency of 11 Hz, a tone so low only fish can hear it.  Argggh, a bad example then, but never mind.  We’ll carry on with this example, whether or not anyone can hear it.  Call the fundamental frequency $f_0$.   Period is seconds (or milliseconds) per cycle, while frequency is cycles per second.

The ratio of high to low is 1:2. This could also be described as 1/3 duty cycle, or 33% duty cycle. The high segment is in 1:3 ratio to the whole period. A sloppy writer might mention the 1:2 high-to-low ratio but not say so, misleading readers into thinking it’s high-to-whole and so they’re thinking it’s a square wave.

Here’s a square wave:

A square wve with 50% duty cycle

The high-to-low segment durations ratio is 1:1. The high segment is in 1:2 ratio with the whole.

Note that there’s really nothing “square” about a square wave. The horizontal axis is time, and the vertical axis is voltage, air pressure, the position of some point on a reed or string or whatever, which may be plotted with any units and scale you please. So there’s nothing going on involving four sides of equal length. It’s just an old convention that a 50% duty cycle pulse train like this is called “square” while otherwise, it’s  “rectangular”.

## HARMONICS

All waveforms may be thought of as sums of sine waves of many frequencies.  The most important sine wave component is the one with the same period as the waveforrm, the “Fundamental”.  For the square wave, it looks like this:

Fundamental sine component of a square wave.

Fits nicely, doesn’t it?  Where the pulse is high, we see the sine is always positive. Its average  value in this segment is, oh, about +0.7 maybe.

Where the pulse is low, we think of that as providing an extra minus sign.  The sine is always negative there, averaging -0.7, but that extra minus sign flips it and gives overall another +0.7, for a total of +1.4.   This nonzero number tells us that this sine wave is a significant component of the square wave.

How about tripling the frequency of the sine wave?  Harmonic the Third.  Three complete cycles fit into the 90ms period.

Third harmonic of a square wave

An odd factoid about jargon – the harmonics are the frequencies higher than the fundamental.  We might think that the sine with twice the fundamental frequency, $f = 2f_0$, being the first of those, would be called the “first harmonic”, and $f = 3f_0$ the “second” and so on.  Indeed, some logic-minded authors write that way. But it’s confusing.  The far more common convention is to include the Fundamental as one of the harmonics.   The captain of a ship is still a member of the crew, right? That allows the numbers to match: $f = 2f_0$ is the “second harmonic”, $f=29f_0$ is the “twenty-ninth harmonic” and so on.  Much nicer!

So why is it common to refer to a fundamental frequency as $f_0$ instead of $f_1$? It is not the zeroth harmonic, is it?  But oh well.. Humans and their primitive math and illogical language…

Anyway, look at that three cycles-per-period harmonic.  What is the average value of the sine in the high pulse segment?  Look at the positive half cycles and negative half cycles.  In the high segment of the pulse, the first positive half cycle cancels out the first negative half cycle, leaving only the other positive half cycle remaining. It’s 1/3 the width of the positive half cycle we saw for the fundamental, so the resulting average value is 1/3 of what we had.  The low segment goes the same way, but negative, but then made positive by the extra negative sign due to being in the low segment.

That’s why the third harmonic of a square wave is 1/3 the amplitude.   I leave it to you to sketch the fifth harmonic and become convinced that its average value is 1/5 of the fundamental.  So now you know where the 1/n harmonic series for square waves comes from.

I’m playing fast and loose here, doing by eye and hand-waving a crude Fourier Transform.  No proofs or equations or airtight arguments, but I hope the essential ideas are clear.

## A LOPSIDED PULSE WAVEFORM

Let us look at that 1/3 duty cycle pulse from the start of this article.  We’ll look at the fundamental and the third harmonic, like we did for the square wave.

Pulse with 1/3 duty cycle, and its fundamental since wave.

In the high segment, we have most of a positive half cycle. So the average value is positive (mumble-mumble) volts.  The low segment has all of the negative half cycle, and also  the intruding remaining part of the positive half cycle.  So we get some negative number, not as strong as for a square wave, and flip it to a positive value due to being in the low segment.  So we total up to some positive value, meaning that yes indeed the fundamental is an important contributor to the signal’s spectrum.

Now consider the third harmonic:

1/3 duty cycle pulse with its third harmonic

Three full cycles per period.  Hey looky here, this is interesting! In the high segment, we find one positive half cycle, and one negative half cycle. They cancel out. The average value is zero.  Likewise, we find zero in the low segment, although twice as much of it.   The average value of the third harmonic is flat zero — Harmonic the Third is *not* present in this particular pulse wave!

## SQUARE WAVES HAVE NO EVEN HARMONICS

Going back to the square wave, we can see why the second harmonic, $f=2f_0$, zeros out, along with any even harmonic.

Square wave with its second harmonic

Each segment of the square wave holds exactly one full cycle of the harmonic sine wave, therefore averages out to zero.  If we  were looking at  the tenth harmonic, we’d find five full cycles of sine wave in each of the high and the low segments.

That’s it for now.  You are now a world-class expert on pulse waveforms and Fourier Transforms. Go forth and create and/or zero out harmonics!

(Illustrations (c) 2014 Daren Scot Wilson, created in Inkscape)

Advertisements