Fourier Series (Com S 477/577 otes) Yan-Bin Jia ov 9, 016 1 Introduction Many functions in nature are periodic, that is, f(x+τ) = f(x), for some fixed τ, which is called the period of f. Though function approximation using orthogonal polynomials is very convenient, there is only one kind of periodic polynomial, that is, a constant. So, polynomials are not good for approximating periodic functions. In this case, trigonometric functions are quite useful. A large class of important computational problems falls under the category of Fourier transform methods or spectral methods. For some of these problems, the Fourier transform is simply an efficient computational tool for data manipulation. For other problems, the Fourier transform is itself of intrinsic interest. Fourier methods have revolutionized fields of science and engineering, from radio astronomy to medical imaging, from seismology to spectroscopy. The wide application of Fourier methods is credited principally to the existence of the fast Fourier transform (FFT). The most direct applications of the FFT are to the convolution or deconvolution of data, correlation and autocorrelation, optimal filtering, power spectrum estimation, and the computational of Fourier integrals. A physical process can be described either in the time domain, by the values of some quantity h as a function of time t, or else in the frequency domain, where the process is specified by giving its amplitude H as a function of frequency ξ with < ξ <. For many purposes it is useful to think of h(t) and H(ξ) as being two different representations of the same function. These two representations are related to each other by the Fourier transform equations, Fourier Series H(ξ) = h(t) = h(t)e iξt dt, H(ξ)e iξt dξ, i = 1. A trigonometric polynomial of order n is any function of the form p(x) = a n 0 + (a j cosjx+b j sinjx), (1) 1
where a 0,...,a n and b 1,...,b n are real or complex numbers. Such a trigonometric polynomial has period. When approximating a function f(x) with period τ, we have to make some adjustment by considering instead the function ( ) g(x) = f τx/(), which has period. Having constructed a trigonometric polynomial approximation p(x) to g(x), we obtain a τ-periodic polynomial approximation p(x/τ) to f(x). For this reason we will from now on assume that the function f(x) to be approximated is already -periodic. The trigonometric polynomial (1) has an equivalent complex form p(x) = n j= n c j e ijx, where i = 1, () under Euler s formula We then expand (): e ix = cosx+isinx. p(x) = c 0 + n (c j +c j )cosjx+i A comparison between the above and (1) yields a j = c j +c j, n (c j c j )sinjx. b j = i(c j c j ), j = 0,...,n. Solution of each pair of such equations gives us, for j = 0,...,n, c j = a j ib j, c j = a j +ib j. The functions 1, e ±ix,e ±ix,..., form an orthonormal basis with respect to the inner product g,h = 1 where h(x) is the complex conjugate of h(x). More specifically, { e ijx,e ikx 1, if j = k, = 0, if j k. The Fourier series for a function f(x) is given by 0 g(x)h(x) dx, (3) f(x) j= ˆf(j)e ijx, (4)
where ˆf(j) = f(x),e ijx = 1 0 f(x)e ijx dx. are the Fourier coefficients. From the above definition we easily see that ˆf( j) = ˆf(j). In (4), means that the Fourier series converges to f(x) under rather mild conditions. For example, the series converges uniformly if f(x) is continuous and f (x) is piecewise continuous. Theorem 1 The partial sum n j= n ˆf(j)e ijx of the Fourier series for f(x) is the best approximation to f(x) by trigonometric polynomials of order n under the inner product defined in (3); that is, with respect to the norm 1 g = g(x) dx. Furthermore, it can be shown that Parseval s relation j= 0 ˆf(j) = 1 f(x) dx 0 holds. The Fourier coefficients ˆf(j) can help us understand the function f(x). Suppose f(x) is a real function with period. It can be viewed as the motion of a point at time x on a line. Substitute the polar form ˆf(j) = ˆf(j) e iθ j into the Fourier series (4) and use the fact that ˆf(j) and ˆf( j) are complex conjugates: f(x) ˆf(0) cosθ 0 + ˆf(j) cos(θ j +jx). Thus we have obtained a representation of the periodic motion as a superposition of simple harmonic oscillations. The jth such motion (with j > 0), ˆf(j) cos(θ j +jx), has amplitude: frequency: angular frequency: j, ˆf(j), j, period or wavelength: j, phase angle: θ j. 3
The number ˆf(j) measures the strength of the presence of a simple harmonic motion of frequency j in the total motion. It can be shown that ( ˆf(j) = O j l 1), (5) when the lth derivative of f(x) exists and is piecewise continuous. The sequence ˆf(0), ˆf(1),... is called the spectrum of f(x) over which the total energy f is distributed. A noisy function will have sizeable ˆf(j) for large j. For a smooth function, the spectrum will decrease rapidly as j increases. The method of smoothing often consists in generating the Fourier coefficients of f(x) from data, filtering these coefficients to suppress high frequencies (which usually correspond to noise), and then reconstructing the function as a Fourier series with purified or filtered coefficients. The figure 1 below shows two -periodic functions and their power spetrums. The second function is obtained from the first by filtering out its higher frequencies. Since it is generally difficult or impossible to compute the Fourier coefficients {ˆf(j)} exactly, we use their discrete approximations that result from sampling f at the points x k = k for k = 0,..., 1. They are ˆf (j) = f,e ijx, j = 0,..., 1 (6) = 1 Here the discrete inner product, is defined as 1 From [1, p. 71]. g,h = 1 f(x k )e ijx k. (7) i=0 g(x i )h(x i ), 4
Under this inner product, the functions 1,e ±ix,e ±ix,... are still orthogonal, namely, { e ikx,e ijx 1, if k = j (mod ), = 0, otherwise. But now we have Equation (8) immediately implies that ˆf (j) = f,e ijx = ˆf(k)e ikx,e ijx by (4) = = k= k= k=j (mod ) ˆf(k) e ikx,e ijx ˆf(k). (8) = ˆf (j ) = ˆf (j) = ˆf (j +) =. The points x 0,...,x are called the sampling points, f(x 0 ),...,f(x ) the sampling values, the sampling interval, and the sampling frequency. From equation (8) we see that all the Fourier coefficients ˆf(k), k = j mod, get mashed together and show up indistinguishably in the discrete Fourier series. This is referred to as aliasing. We cannot tell the difference between two basis functions e ik and e ij, k = j (mod ), because they agree at all sampling point x 0,...,x. Aliasing is illustrated 3 on the next page on a continuous function in (a) which is nonzero only for a finite time interval T. The Fourier transform of the function, shown in (b), has no limited bandwidth but rather finite amplitude for all frequencies. Suppose the original function is sampled with a sampling interval, then the resulting Fourier transform in(c) is defined between frequencies 1 and 1. Power outside that frequency range is folded over or aliased into the range.4 To eliminate this effect, the original function should go through low-pass filtering before sampling. Plugging (5) into (8) yields ˆf (j) = O ( k l 1) k=j (mod ) = ˆf (ĵ ) +O ( ( ) ) l 1, where ĵ = { j mod, if 0 j mod ; (j mod ), if j mod >. To generalize, for a function with period τ, the sampling frequency is. 3 τ The figure is from [3, p. 507]. 4 This folding effect is in part created by H( f) = H(f). 5
So we see that the Fourier coefficients ˆf(j) with j dominate other coefficients. For this reason, ˆf (j) is usually taken only as an approximation to ˆf(j) with j. Thus when we sample a real function at equally spaced points, in the interval [0, ), the aliasing effect prevents the observation of periodic phenomena in f(x) with frequencies higher than (/)/. Phrased differently, we have the following result. (c) Theorem (Sampling Theorem) If we wish to observe a certain periodic phenomenon of frequency v, then we must sample at a frequency at least as large as v. Observe that ˆf ( j) is a conjugate of ˆf (j), for all j, since ˆf ( j) = f,e i( j)x by (6) = 1 = 1 f(x k )e i( j)x k by (7) f(x k )e ijx k = ˆf (j). by (7) The corresponding trigonometric polynomial approximant of f(x) has the form: p(x) = ˆf (j)e ijx +Re (ˆf (/)e i(/)x) j </ 6
= ˆf (0)+Re / 1 ˆf (j)e ijx +Re(ˆf (/)e i(/)x). The last term is present only when is even. Having mentioned it for completeness s sake, we will now discuss the case when is odd, that, is = n+1 for some integer n. In this case, the functions 1, e ±ix,...,e ±inx are orthonormal with respect to the discrete inner product,. By virtually the same reasoning of least-squares approximation by orthogonal polynomials, we have the following theorem. Theorem 3 For any m n =, the mth order trigonometric polynomial m p m (x) = ˆf (j)e ijx j= m is the best approximation to f(x) by trigonometric polynomials of order m with respect to the discrete mean-square norm g = ( g,g )1 = 1 ( ( k ) ) 1 g. 3 Fast Computation FFT We are interested in the frequencies present in f(x) and their strength (or magnitude). But due to aliasing, ˆf (j), defined in (7), is good as an approximation to f(j) only for < j. Thus, for very large we want to be able to calculate ˆf (j), for 0 j, or equivalently, for 0 j 1, from f(x 0 ),...,f(x ), where x k = k. A straightforward calculation would take time O( ). A significant improvement can be achieved by reducing the above problem to a discrete Fourier transform (DFT). DFT is the mapping z 0 ẑ 0 z 1 z =. ẑ = ẑ 1. such that ẑ j = z ẑ z k ω jk, j = 0,..., 1, where ω is an th root of 1, that is, ω = e i. The mapping can also be written as a matrix equation: 1 1 1 1 z 0 ẑ 0 1 ω ω ω z 1..... = ẑ 1.. 1 ω ω () ω () 7 z ẑ
If we take z j = f(x j ), 0 j 1, then ˆf (j) = 1 ẑj, j = 0,1,..., 1. To verify, by definition (7) we have ˆf (j) = 1 = 1 = 1 f(x k )e ijx k k ij f(x k )e ( ) k f(x k ) ω j = 1 ẑj. Fast Fourier transformallows usto computethediscretefourier coefficients intime O( log). With = 10 6, for example, the improvement is from roughly two weeks of CPU time to 30 seconds! References [1] S. D. Conte and C de Boor. Elementary umerical Analysis: An Algorithmic Approach. McGraw-Hill, Inc., 3rd edition, 1980. [] M. Erdmann. Lecture notes for 16-811 Mathematical Fundamentals for Robotics. The Robotics Institute, Carnegie Mellon University, 1998. [3] W. H. Press, et al. umerical Recipes in C++: The Art of Scientific Computing. Cambridge University Press, nd edition, 00. 8