Fourier Series Applet, Curve fitting

Cuthbert Nyack
The Coefficients of the Fourier series are also what would be obtained if a least squares curve fitting analysis is done with sinusoidal harmonics being used to fit the function. The analysis is illustrated in the MathCad file below for a square wave defined by f(t). Both a1 and a3 have their correct values (4/p) and (4/3p) when fitting is done.


The Applet below illustrates the connection between Least Squares and the magitude of the Fourier Coefficient for a quadratic, a triangular and a rectangular wave.

Fn = 1 is the case for n = 1 for a quadratic wave. Parameters T1 to T4 can be adjusted to give the least error.
Fn = 2 shows the error is a minimum when the amplitude is 1.03204919 compared with the correct value of 1.03204910186.
The accuracy of the applet is limited by the simple numerical integration algorithm used.

Fn = 3 is the case of n = 3 for a quadratic wave and Fn = 4 shows the minimum error case. Fn = 5 and 6 shows the n = 5 case.
Fn = 7 and 8 shows the n = 1 case for the triangular wave.
Fn = 9 and 10 shows the n = 3 case for the triangular wave.
Fn = 11 and 12 shows the n = 5 case for the triangular wave.

Fn = 13 and 14 shows the n = 1 case for the rectangular wave.
The other cases Fn = 15 to 30 shows n = 2, 3, 5, 6, 7, 9, 10 and 11 for the rectangular wave.




Return to main page
Return to page index
COPYRIGHT © 1996, 2012 Cuthbert Nyack.