Example 2.  Assume that [Graphics:Images/FourierSeriesMod_gr_84.gif] is periodic with period  [Graphics:Images/FourierSeriesMod_gr_85.gif],  i.e.  [Graphics:Images/FourierSeriesMod_gr_86.gif],  and is defined by
        [Graphics:Images/FourierSeriesMod_gr_87.gif]  for  [Graphics:Images/FourierSeriesMod_gr_88.gif].  
Find the Fourier polynomial of degree n = 5  for the 12  equally spaced points in the interval  [Graphics:Images/FourierSeriesMod_gr_89.gif].  
Use the "numerical integration" method for finding the coefficients.

Solution 2.

Enter the function using the piecewise definition.

[Graphics:../Images/FourierSeriesMod_gr_90.gif]

[Graphics:../Images/FourierSeriesMod_gr_91.gif]

Enter the number of subintervals n and the degree m of the Fourier polynomial.

[Graphics:../Images/FourierSeriesMod_gr_92.gif]

Construct the coefficients [Graphics:../Images/FourierSeriesMod_gr_93.gif], [Graphics:../Images/FourierSeriesMod_gr_94.gif] and the Fourier polynomial.

[Graphics:../Images/FourierSeriesMod_gr_95.gif]


[Graphics:../Images/FourierSeriesMod_gr_96.gif]
[Graphics:../Images/FourierSeriesMod_gr_97.gif]
[Graphics:../Images/FourierSeriesMod_gr_98.gif]

Construct the Fourier polynomial using the coefficients [Graphics:../Images/FourierSeriesMod_gr_99.gif]and [Graphics:../Images/FourierSeriesMod_gr_100.gif].

[Graphics:../Images/FourierSeriesMod_gr_101.gif]

[Graphics:../Images/FourierSeriesMod_gr_102.gif]

We are done !
We can graph the situation for fun.  

[Graphics:../Images/FourierSeriesMod_gr_103.gif]


[Graphics:../Images/FourierSeriesMod_gr_104.gif]

[Graphics:../Images/FourierSeriesMod_gr_105.gif]

[Graphics:../Images/FourierSeriesMod_gr_106.gif]

Remark. The coefficients are approximations to the ones found analytically using symbolic integrations.  
However, when only data points are used, the numerical integration method must be used.
As we will see, the FFT is a more efficient way to integrate.

[Graphics:../Images/FourierSeriesMod_gr_107.gif]



[Graphics:../Images/FourierSeriesMod_gr_108.gif]
[Graphics:../Images/FourierSeriesMod_gr_109.gif]
[Graphics:../Images/FourierSeriesMod_gr_110.gif]
[Graphics:../Images/FourierSeriesMod_gr_111.gif]
[Graphics:../Images/FourierSeriesMod_gr_112.gif]

[Graphics:../Images/FourierSeriesMod_gr_113.gif]
[Graphics:../Images/FourierSeriesMod_gr_114.gif]
[Graphics:../Images/FourierSeriesMod_gr_115.gif]
[Graphics:../Images/FourierSeriesMod_gr_116.gif]
[Graphics:../Images/FourierSeriesMod_gr_117.gif]


[Graphics:../Images/FourierSeriesMod_gr_118.gif]


[Graphics:../Images/FourierSeriesMod_gr_119.gif]

[Graphics:../Images/FourierSeriesMod_gr_120.gif]

[Graphics:../Images/FourierSeriesMod_gr_121.gif]

[Graphics:../Images/FourierSeriesMod_gr_122.gif]

[Graphics:../Images/FourierSeriesMod_gr_123.gif]

Caveat.  When creating the sums which define the coefficients [Graphics:../Images/FourierSeriesMod_gr_124.gif], [Graphics:../Images/FourierSeriesMod_gr_125.gif] be sure to sum up only n terms [Graphics:../Images/FourierSeriesMod_gr_126.gif].
Remember, "numerical integration" is being used and  [0,2L]  is subdivided into n subintervals, not n+1 subintervals.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004