Lab for Trigonometric Polynomial Approximation (FFT)

Module for Fourier Series

Module for Discrete Fourier Series (FFT)

  Check out the new Numerical Analysis Projects page.

 

Background. Trigonometric Polynomials. To construct and evaluate the trigonometric polynomial of order m of the form
[Graphics:at.txtgr1.gif],
based on the n equally spaced values [Graphics:at.txtgr2.gif]. The construction is possible provided that [Graphics:at.txtgr3.gif].

Load in Mathematica's graphics package "Colors".

[Graphics:at.txtgr5.gif][Graphics:at.txtgr4.gif]
 
 

Report to be handed in.

Computer Exercises
 

   
   

Exercise 1. Find the trigonometric polynomial of degree n = 5 for the 12 equally spaced points in the interval [Graphics:at.txtgr6.gif] for the function:
[Graphics:at.txtgr7.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr8.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr9.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr10.gif]

Caution. We will use Mathematica's "Fit" procedure to construct the trigonometric polynomial. Since the method of "least squares" is used, we must only use the data point at one of the endpoints of the interval.

[Graphics:at.txtgr5.gif][Graphics:at.txtgr11.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr12.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr13.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr14.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr15.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr16.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr17.gif]
 
 

Background. Remark 1. The coefficients are the same as the values obtained by performing numerical integration to find the Fourier series coefficients based on the 12 subintervals. For example the Riemann sum can be used:

[Graphics:at.txtgr5.gif][Graphics:at.txtgr18.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr19.gif]

The integrals for the other coefficients are zero, i.e. a0 = 0, a2 = 0 and a4 = 0.

 

Background. Aside remark 2. Trigonometric curve fitting at discrete points is equivalent to finding the Fast Fourier Transform (FFT) for a discrete data set. The coefficients of the trigonometric polynomial can be obtained using Mathematica's built in "Fourier" procedure.

 

 

More of the computer project for trigonometric curve fitting.

The daily temperature for Fairbanks, Alaska can be obtained from the USGS which gives an "average temperature" to expect for each day of the year. If we used all of this information it would take a considerable amount of typing skill (not to mention patience) to enter the data. Since there are approximately 364 days in a year, and [Graphics:at.txtgr32.gif] we choose to sample the temperature every 28 days and obtain a reduced sample set to 13 points. Then we can experiment with the trigonometric curve fitting.

The yearly temperature data for Fairbanks, Alaska is:

[Graphics:at.txtgr5.gif][Graphics:at.txtgr33.gif]
 
 

Exercise 2. Find the "trigonometric polynomial curve fit" of degree m = 1:
[Graphics:at.txtgr34.gif]

Carefully enter the above data into the Mathematica array xts.

[Graphics:at.txtgr5.gif][Graphics:at.txtgr35.gif]

First, fit the data to a periodic function of the form [Graphics:at.txtgr36.gif].

[Graphics:at.txtgr5.gif][Graphics:at.txtgr37.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr38.gif]

Graph the data points and the trigonometric polynomial [Graphics:at.txtgr39.gif].

[Graphics:at.txtgr5.gif][Graphics:at.txtgr40.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr41.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr42.gif]

Print a table of the data points, the function, and the difference.

[Graphics:at.txtgr5.gif][Graphics:at.txtgr43.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr44.gif]
 
 

Exercise 3. What is the largest discrepancy between [Graphics:at.txtgr45.gif] in question 1 and the temperature data ?

[Graphics:at.txtgr5.gif][Graphics:at.txtgr46.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr47.gif]
 
 

Exercise 4. Write down the "trigonometric polynomial curve fit" of degree m = 2:
[Graphics:at.txtgr48.gif]

Second, fit the data to a periodic function of the form
[Graphics:at.txtgr49.gif].

[Graphics:at.txtgr5.gif][Graphics:at.txtgr50.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr51.gif]

Graph the data points and the trigonometric polynomial [Graphics:at.txtgr52.gif].

[Graphics:at.txtgr5.gif][Graphics:at.txtgr53.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr54.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr55.gif]

Print a table of the data points, the function, and the difference.

[Graphics:at.txtgr5.gif][Graphics:at.txtgr56.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr57.gif]
 
 

Exercise 5. What is the largest discrepancy between [Graphics:at.txtgr58.gif] in question 3 and the temperature data ?

[Graphics:at.txtgr5.gif][Graphics:at.txtgr59.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr60.gif]
 
 

Exercise 6. What is the predicted temperature in Fairbanks, Alaska on Nov. 19 ?
[Graphics:at.txtgr61.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr62.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr63.gif]
 
 

Exercise 6. What is the predicted temperature in Fairbanks, Alaska on July 2 ?
[Graphics:at.txtgr64.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr65.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr66.gif]
 
 

Concluding Remark. Since there are 13 data points, the trigonometric polynomial of degree m = 6 will fit the data "exactly".

[Graphics:at.txtgr5.gif][Graphics:at.txtgr67.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr68.gif]

Graph the data points and the function.

[Graphics:at.txtgr5.gif][Graphics:at.txtgr69.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr70.gif]

[Graphics:at.txtgr5.gif][Graphics:at.txtgr71.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr72.gif]
[Graphics:at.txtgr5.gif][Graphics:at.txtgr73.gif]
 

 

 

(c) John H. Mathews, 1998