If we have a fundamental sine wave (1st harmonic) of the following form
(for time-domain waves, x may be replaced by ft, where f is the fundamental frequency and t is the time point):
and add nth harmonics of the form:
(where A1 = 1 and B1 = 0 for the fundamental) then the waveform resulting from summing the
first N harmonics (including the fundamental) can be expressed as:
We define w∞ to be the limiting case when an infinite number of harmonics are added:
Examples
Harmonics (N):
Figure 1: Harmonic sum wN(x) compared to limiting case w∞(x).
Figure 2: Individual harmonics hn(x) which form wN(x) in figure 1.
Notes
The modulo operator used here binds tighter than plus and minus, and is defined as:
(x and y don't need to be integers).
X(x) is a helper function used to achieve periodicity in the definitions of w∞(x). X(x) is identical to x in the range -0.5 ≤ x < 0.5 and repeats itself periodically:
J1(x) is the first-order Bessel function of the first kind.