Here's a program for a Fourier analysis of multilevel periodic waveforms having
horizontal sections and vertical risers (Fig.
1, a).
Data entry to the program, FOURIER.BAS, consists of entering the starting
angle, ending angle, and the segment level between these two angles (Fig.
1, b). Data entry ends when a full cycle is covered (ending angle is
360°). Note that it's convenient to normalize the waveform to a
peak-to-peak value of 1.0, to aid in comparing harmonics.
The waveform can be expressed as (ignoring the dc component):
Vn (t) = a(n) × cos(2Πnf1t) + b(n)
\[time sign\] sin(2\[PI sign\]nf1t)
where f1 is the fundamental frequency. The phase angle of the harmonic
can be found from tan-1(b(n)/a(n)).
The program (Fig. 2) calculates:
1. a(n) and b(n).
2. The peak magnitude of the harmonic \[ a(n)2 + b(n)2\]0.5
3. The level in decibels of the harmonic, relative to the level of the fundamental,
for levels greater than -99.99 dB. If the level of a certain harmonic is smaller
than -99.99 dB, the program skips that harmonic.
In the simple example given, all of the even harmonics are missing. In addition,
the 3rd and 9th are down more than 99.99 dB relative to the fundamental.