Square waves are based on a fundamental frequency and its odd harmonics. How many harmonics do you need to get a good enough representation of a square wave to calculate its rise time with enough accuracy?
There are several ways to evaluate the bandwidth of a signal in the time domain and frequency domain. Previously we looked at the classic relationship of rise time (tr) and bandwidth (f3db) [Ref 1], captured by this equation:
Eric Bogatin also provided Rule of Thumb #2 for estimating the signal bandwidth from the clock frequency [Ref 2]. Eric emphasizes that you really should use the rise time to calculate signal bandwidth, but you can get a reasonable answer quickly using this Rule of Thumb:
In Eric’s article, he makes a key assumption that the rise time is 7% of the period. That’s a reasonable assumption that gets us into the right ballpark on rise time. Some signals will, however, be faster while some will be slower.
Another way to evaluate a signal’s bandwidth is through frequency domain analysis, or more specifically by using the Fourier Series. The Fourier Series for a square wave, as shown in Figure 1, is [Ref 3]:
The series has an infinite number of odd harmonics that combine to represent the square wave. Each higher harmonic is smaller in amplitude than the previous one due to the 1/n term in the equation. Because our ideal square wave has zero rise time, the bandwidth of the signal is going to be infinite. Put another way, we need to include all the harmonics to represent the square wave perfectly. The time scale is arbitrary. The waveform period is ten time units.
Table 1 lists the coefficients (zero-to-peak values) for the sinewave terms, starting with the fundamental (n =1) through the 11th harmonic.
Let’s examine how many harmonics we need to include to have the waveform look like a decent square wave. Figure 2 shows just the fundamental frequency, a pure sine wave.
Figure 3 adds in the third harmonic, which starts to make the waveform a bit more like a square wave.
Figure 4 adds in the fifth harmonic and now we see the waveform looking even more like a square wave.
Each additional harmonic produces a waveform that looks more like a square wave. We won’t plot all of them in Table 1, but Figure 5 shows the waveform out to the 11th harmonic. Higher-order harmonics make the waveform more square and leave higher frequency ripples in the flat parts of the waveform.
Adding in a specific number of harmonics is equivalent to applying a brick-wall low-pass filter in the frequency domain. The desired harmonics are included in the waveform and the higher harmonics are eliminated. This is somewhat artificial because in the real world, we would probably have a frequency response than rolls off gradually with some remnants of the higher harmonics still present.
Qualitatively, the 5th harmonic waveform looks like a respectable square wave, so let’s take a closer look at that case. Figure 6 shows this waveform with expanded horizontal axis such that we can determine the rise time using graphical techniques.
Let’s find the 10% and 90% points on the waveform and estimate the rise time. The total signal swing is 2 units so the 10% and 90% points are -0.8 and +0.8. The rise time is 2 × 0.37 = 0.74 units. Recall that the period of the waveform is 10, so this gives us a rise time that is 0.74/10 = ~7% of the period. Now isn’t that interesting? This is very close to the 7% (of period) rise time assumed in Rule of Thumb #2. Of course, our choice of including up to the fifth harmonic was an arbitrary decision based on the waveform shape. It just looked pretty good. You could argue that we need more harmonics or perhaps even less, depending on the specific application.
In summary then, we used Fourier Series analysis to determine the amplitude of the harmonics in a square wave. Then we estimated the rise time of a square wave made up of the fundamental plus the third and fifth harmonics. It matches well with Rule of Thumb #2 for estimating the bandwidth of a digital signal (five times the clock frequency).
—Bob Witte is president of Signal Blue LLC, a technology consulting company.