Example 4. Given
the 12 equally spaced data points
![]()
![]()
![]()
![]()
which can be extended periodically over
,
if we define
.
Find the Fourier polynomial of degree n = 5 for the
12 equally spaced points over
interval
.
Use Mathematica's Fit subroutine to find the coefficients.
Solution 4.
Note. The data are
computed using the function
,
which is the function that was used in examples 1 -
3.
Construct the data points to be used.
![[Graphics:../Images/FourierSeriesMod_gr_207.gif]](../Images/FourierSeriesMod_gr_207.gif)
Remark. Notice that
precisely 12 data points are used and a point corresponding to
is not used.
Remark. The Mathematica procedure Fit can be used to numerically compute the trigonometric polynomial.
![[Graphics:../Images/FourierSeriesMod_gr_212.gif]](../Images/FourierSeriesMod_gr_212.gif)
Caveat. The
underlying function f(x) is even which requires that only cosine
terms be used for the Fourier trigonometric polynomial.
Since f(x) has period
,
if data points were used at both end of the interval
then the "least squares" algorithm would weight the function value
twice, whereas all other function values would have weight
1. If 13 data points were used which included the right
end point, then a wrong answer will result, and spurious terms appear
in the trigonometric polynomial. Look at the wrong answer.
Wrong Answer.
![[Graphics:../Images/FourierSeriesMod_gr_228.gif]](../Images/FourierSeriesMod_gr_228.gif)
(c) John H. Mathews 2004