# Fourier Series Applet, Spectrum and Waveform Reconstruction

Cuthbert Nyack
In this page, the Fourier series is used to reconstruct some simple periodic waves.
 First a Square wave F(t) and its spectrum an is shown. Since this wave is even the spectrum includes only even terms with bn = 0 for all n. The expression for the spectrum is shown below. Since the terms decrease as 1/n, then the series converge slowly. Slow convergence is characteristic of functions with discontinuities. The square wave has disconuities in F(t) at -T/4 (-1 to +1) and at +T/4 (+1 to -1).  A Triangular wave F(t) and its spectrum bn is shown opposite. Unlike the square wave it does not have disconuities in F(t). However there are discontinuities in its derivatives at -T/4 and +T/4. Convergence of the series is faster than that for the square wave as shown by the spectrum plotted opposite. In this case the wave is odd and its Spectrum is also odd with an = 0 for all n. The expression for the Fourier series is given below.  The applet below shows the reconstruction of a square and triangular wave from their Spectrum. Fn = 0 shows the reconstruction of a square wave and Fn = 1 shows the reconstruction of a triangular wave.
ns changes the number of terms summed.
t shows the error at any time within a period.
eok, mk changes the gain of the even/odd, magnitude spectrum.
ek changes the gain of the error.