Description
Reading:
C. Moler ”Numerical Computing with Matlab” (online, free download), Ch. 8
1. Implement either the DFT or the FFT algorithm as well as construction of the Fourier
approximation of a function from its Fourier coefficients. Make sure to modify the formulas
to take into account that Matlab indexing starts at 1. Submit a print-out, as usual
2. Apply your code to the following functions, plot the results of the Fourier approximation
and the original function. Choose your own sampling rate n, possibly several ones.
(a) f(x) = x. This function is discontinuous and you will see that a Fourier approximation
will oscillate near the discontinuity. This is called the Gibbs phenomenon.
(b) f(x) = exp(cos(2πx)). You should expect a good approximation here.
(c) f(x) = ((x − 0.5)/0.5)2
. This function is continuous, but approximation is not as good
as in (b). Why?
(d) f = ((x − 0.5)/0.5)m, m = 5, 10, 25, 50, .. with a fixed number of sampling points.
Explain the observed behavior. It might be easier to plot the error here.
3. (a) Derive by hand the continuous Fourier Series of f(x) = (cos(8πx))4
. Compare the
discrete and continuous Fourier coefficients with n = 5, 11, 21. Explain your findings.
(b) Repeat with f(x) = x.
4. Derive formulas for using the DFT when f is sampled on an arbitrary interval [a, b]. Modify
your code and submit an example of a Fourier approximant on [a, b] for same simple function.
5. (bonus) Come up with a sequence of functions {fk} that are k times differentiable and
periodic with period one. Try to see numerically that the error in Fourier approximation
decays at about n
−k
rate.
6. (bonus) Problems 8.1, 8.2 in Moler. File touchtone.zip is posted on Learn.
1