![]()
![]()
Lab for Trigonometric Polynomial Approximation (FFT)
![]()
Background.
Trigonometric Polynomials. To
construct and evaluate the trigonometric polynomial of order m of the
form
,
based on the n equally spaced values
.
The construction is possible provided that
.
Load in Mathematica's graphics package "Colors".
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
for the function:
![]()
![]()
![[Graphics:at.txtgr10.gif]](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.txtgr16.gif]](at.txtgr16.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:
The integrals for the other coefficients are zero, i.e. a0 = 0, a2 = 0 and a4 = 0.
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
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:
Exercise 2. Find the
"trigonometric polynomial curve fit" of degree m = 1:
![]()
Carefully enter the above data into the Mathematica array xts.
First, fit the data to a periodic function of the form
.
Graph the data points and the trigonometric polynomial
.
![]()
![[Graphics:at.txtgr41.gif]](at.txtgr41.gif)
Print a table of the data points, the function, and the difference.
Exercise 3. What is the
largest discrepancy between
in question 1 and the temperature data ?
Exercise 4. Write down the
"trigonometric polynomial curve fit" of degree m = 2:
![[Graphics:at.txtgr48.gif]](at.txtgr48.gif)
Second, fit the data to a periodic function of the form
.
Graph the data points and the trigonometric polynomial
.
![]()
![[Graphics:at.txtgr54.gif]](at.txtgr54.gif)
Print a table of the data points, the function, and the difference.
Exercise 5. What is the
largest discrepancy between
in question 3 and the temperature data ?
Exercise 6. What is the
predicted temperature in Fairbanks, Alaska on Nov. 19 ?
![[Graphics:at.txtgr61.gif]](at.txtgr61.gif)
Exercise 6. What is the
predicted temperature in Fairbanks, Alaska on July 2 ?
![[Graphics:at.txtgr64.gif]](at.txtgr64.gif)
Concluding Remark. Since there are 13 data points, the trigonometric polynomial of degree m = 6 will fit the data "exactly".
Graph the data points and the function.
![]()
![[Graphics:at.txtgr70.gif]](at.txtgr70.gif)
![]()
![]()
(c) John H. Mathews, 1998