Lecture VIII: Fourier series Maxim Raginsky BME 171: Signals and Systems Duke University September 19, 2008 Maxim Raginsky Lecture VIII: Fourier series This lecture Plan for the lecture: 1 Review of vectors and vector spaces 2 Vector space of continuous-time signals 3 Vector space of T -periodic signals 4 Complete orthonormal systems of functions 5 Trigonometric Fourier series 6 Complex exponential Fourier series Maxim Raginsky Lecture VIII: Fourier series Review: vectors Recall vectors in n-space Rn . Each such vector u can be uniquely represented as a linear combination of n unit vectors e1 , . . . , en : u = α1 e1 + α2 e2 + . . . + αn en , where α1 , . . . , αn are real numbers (coefficients). These can be computed using the scalar (or dot) product as follows: αk = u · ek , k = 1, . . . , n Note that the vectors e1 , . . . , en are: normalized — ek · ek = 1 for all k orthogonal — ek · em = 0 for k 6= m y u 5 Example: u, v in R2 u = 3e1 + 5e2 v = 6.5e1 + 3e2 v 3 e2 0 e1 3 6.5 x Maxim Raginsky Lecture VIII: Fourier series Vector spaces By definition, vectors are objects that can be added together and multiplied by scalars: Pn Pn if u = k=1 αk ek and v = k=1 βk ek , then we can form their sum u+v = n X (αk + βk )ek k=1 if u = Pn k=1 αk ek and β is a scalar, then we can form the vector βu = n X βαk ek k=1 More generally, a collection of objects that can be added and/or multiplied by scalars is called a vector space. Maxim Raginsky Lecture VIII: Fourier series Signal spaces We have already seen one example of a vector space — the space of continuous-time signals. We can easily verify: we can form the sum of any two signals x1 (t) and x2 (t) to get another signal x(t) = x1 (t) + x2 (t) we can multiply any signal x(t) by a constant c to get another signal z(t) = cx(t) Unlike the n-space Rn , the vector space of all continuous-time signals is huge. In fact, it is infinite-dimensional. Maxim Raginsky Lecture VIII: Fourier series The space of periodic signals Let us consider all T -periodic signals. Any such signal x(t) satisfies x(t + T ) = x(t) for all t for some given T > 0. It is easy to see that T -periodic signals form a vector space: if x1 (t) and x2 (t) are T -periodic, then x1 (t + T ) + x2 (t + T ) = x1 (t) + x2 (t), so their sum is T -periodic if x(t) is T -periodic, then cx(t + T ) = cx(t), so any scaled version of x(t) is also T -periodic If we impose even more conditions on our T -periodic signals (the so-called Dirichlet conditions, which hold for all signals encountered in practice), then we can represent signals as infinite linear combinations of orthogonal and normalized (orthonormal) vectors. Maxim Raginsky Lecture VIII: Fourier series Complete orthonormal sets of functions First of all, we can define a scalar (or dot) product of two T -periodic signals x1 (t) and x2 (t) as Z T hx1 , x2 i = x1 (t)x2 (t)dt 0 (note that we can integrate over any whole period, not necessarily from t = 0 to t = T ). Then we can take any sequence of T -periodic functions (signals) φ0 (t), φ1 (t), φ2 (t), . . . that are Z T 1 normalized: hφk , φk i = φ2k (t)dt = 1 0 2 3 orthogonal: hφk , φm i = Z T 0 φk (t)φm (t)dt = 0 if k 6= m complete: if a signal x(t) is such that Z T hx, φk i = x(t)φk (t)dt = 0 for all k, then x(t) ≡ 0 0 Maxim Raginsky Lecture VIII: Fourier series Fourier series Let {φk (t)}∞ k=1 be a complete, orthonormal set of functions. Then any “well-behaved” T -periodic signal x(t) can be uniquely represented as an infinite series ∞ X x(t) = αk φk (t). k=0 This is called the Fourier series representation of x(t). The scalars (numbers) αk are called the Fourier coefficients of x(t) (with respect to {φk (t)}) and are computed as follows: αk = hx, φk i = Z T x(t)φk (t)dt 0 In analogy to vectors in n-space, you can think of αk as the projection (or component) of x(t) in the direction of φk (t). Maxim Raginsky Lecture VIII: Fourier series Fourier coefficients To derive the formula for αk , write x(t)φk (t) = ∞ X αm φm (t)φk (t), m=0 and integrate over one period: Z 0 | T x(t)φk (t)dt {z } = Z T 0 hx,φk i = ∞ X m=0 = αk , ∞ X ! αm φm (t)φk (t) dt m=0 αm Z |0 T φm (t)φk (t)dt {z } hφm ,φk i where in the last line we use the fact that {φk } form an orthonormal system of functions. Maxim Raginsky Lecture VIII: Fourier series Convergence of Fourier series It can be proved that, because the functions {φk } form a complete orthonormal system, the partial sums of the Fourier series x(t) = ∞ X αk φk (t) k=0 converge to x(t) in the following sense: lim N →∞ Z T 0 x(t) − !2 N X αk φk (t) N X αk φk (t) k=1 dt = 0 So, we can use the partial sums xN (t) = k=1 to approximate x(t). Maxim Raginsky Lecture VIII: Fourier series Trigonometric Fourier series Fact: the sequence of T -periodic functions {φk (t)}∞ k=0 defined by q 2 sin(kω0 t), if k ≥ 1 is odd 1 qT and φk (t) = φ0 (t) = √ 2 T if k > 1 is even T cos(kω0 t), is complete and orthonormal. Here, ω0 = 2π T is called the fundamental frequency. Orthonormality is quite easy to show, completeness — not so much. Thus, any well-behaved T -periodic signal x(t) can be represented as an infinite sum of sinusoids (plus a constant term α0 φ0 ): x(t) = ∞ X αk φk (t) k=0 Maxim Raginsky Lecture VIII: Fourier series Trigonometric Fourier series A more common way of writing down the trigonometric Fourier series of x(t) is this: x(t) = a0 + ∞ X ak cos(kω0 t) + k=1 ∞ X bk sin(kω0 t) k=1 Then the Fourier coefficients can be computed as follows: a0 ak bk = = = 1 T 2 T 2 T Z T x(t)dt 0 Z T x(t) cos(kω0 t)dt 0 Z T x(t) sin(kω0 t)dt 0 Recall that ω0 = 2π/T . Maxim Raginsky Lecture VIII: Fourier series Trigonometric Fourier series To relate this to the orthonormal representation in terms of the φk , we note that we can write Z T 1 1 x(t)φ0 (t)dt = √ α0 a0 = √ T T r r Z0 T 2 2 α2k x(t)φ2k (t)dt = ak = T 0 T r Z T r 2 2 bk = α2k−1 x(t)φ2k−1 (t)dt = T 0 T Thus, we have ∞ ∞ X X x(t) = a0 + ak cos(kω0 t) + bk sin(kω0 t) k=1 √ 1 = √ αk · T φ0 (t) + T = ∞ X r 2 T k=1 ∞ X k=1 α2k · r ∞ X T φ2k (t) + α2k−1 · 2 k=1 αk φk (t) k=1 Maxim Raginsky Lecture VIII: Fourier series r ! T φ2k−1 (t) 2 Symmetry properties Things to watch out for when computing the Fourier coefficients: if x(t) is an even function, i.e., x(t) = x(−t) for all t, then all its sine Fourier coefficients are zero: Z 2 T /2 x(t) sin(kω0 t)dt = 0 bk = T −2/T if x(t) is an odd function, i.e., x(t) = −x(−t), then all its cosine Fourier coefficients are zero: Z 2 T /2 x(t) cos(kω0 t)dt = 0, ak = T −2/T and a0 = 1 T Maxim Raginsky Z T /2 x(t)dt = 0 −2/T Lecture VIII: Fourier series Trigonometric Fourier series: example Consider a 2-periodic signal x(t) given by repeating the square wave: 1 bk 0.8 0.6 = 0 −1 0.4 0.2 = 0 −0.2 −0.4 −0.6 = −0.8 −1 −1 Z −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 = a0 = 0 and ak = 0 for all k (the signal has odd symmetry) x(t) = − = ∞ X 4 sin2 (kπ/2) k=1 kπ Maxim Raginsky sin(kπt)dt − Z 1 sin(kπt)dt 0 1 1 0 1 [cos(kπt)]−1 + [cos(kπt)]0 kπ kπ 1 cos(−kπ) − 1 + cos(kπ) − 1 kπ 1 (2 cos(kπ) − 2) kπ 4 sin2 (kπ/2) − kπ − sin(kπt) = − ∞ X 4 sin(kπt) kπ k odd Lecture VIII: Fourier series Trigonometric Fourier series: example Approximating x(t) by partial sums of its Fourier series: N = 10 N = 15 1.5 1.5 1 1 0.5 0.5 0 0 −0.5 −0.5 −1 −1.5 −1 −1 −0.5 0 0.5 1 −1.5 −1 −0.5 N = 50 0.5 1 0.5 1 N = 150 1.5 1.5 1 1 0.5 0.5 0 0 −0.5 −0.5 −1 −1.5 −1 0 −1 −0.5 0 0.5 1 −1.5 −1 −0.5 0 Note the Gibbs phenomenon: the Fourier series (over/under)shoots the actual value of x(t) at points of discontinuity. In signal processing, this effect is also called ringing. Maxim Raginsky Lecture VIII: Fourier series Complex exponential Fourier series Another useful complete orthonormal set is furnished by the complex exponentials: 1 φk (t) = √ ejkω0 t , T k = . . . , −2, −1, 0, 1, 2, . . . where ω0 = 2π/T , as before. Note that these functions are complex-valued, and we need to redefine the dot product as hx1 , x2 i = Z T x1 (t)x∗2 (t)dt, 0 where x∗1 (t) denotes the complex conjugate of x2 (t). Then it is straightforward to show that Z 1 T jkω0 t −jmω0 t 1, k = m hφk , φm i = e e dt = 0, k 6= m T 0 Maxim Raginsky Lecture VIII: Fourier series Complex exponential Fourier series Thus, we can expand any T -periodic x(t) as ∞ X x(t) = ck ejkω0 t k=−∞ The Fourier coefficients are given by ck = 1 T Z T x(t)e−jkω0 t dt 0 To derive this, multiply the series representation of x(t) on the right by e−jkω0 t and integrate from 0 to T . Maxim Raginsky Lecture VIII: Fourier series Symmetry properties for real signals Consider a real-valued T -periodic signal x(t). Then ck = 1 T Z T x(t)e−jkω0 t dt and c−k = 0 1 T Z T x(t)ejkω0 t dt = c∗k 0 Write ck in polar form: ck = Ak ejθk , Ak = |ck |, θk = ∠ck Then ck = c∗−k ⇒ Ak = A−k and ∠ck = −∠c−k Thus, for real signals the amplitude spectrum Ak has even symmetry, while the phase spectrum θk has odd symmetry. Maxim Raginsky Lecture VIII: Fourier series Amplitude and phase spectra We can use the amplitudes Ak and the phases θk to represent the spectrum (or frequency content) of x(t) graphically as follows: A(ω) −3ω0−2ω0 −ω0 0 ω0 2ω0 3ω0 ω θ(ω) −3ω0−2ω0 −ω0 0 ω0 2ω0 3ω0 ω Observe that the amplitude spectrum A(ω) has even symmetry, while the phase spectrum θ(ω) has odd symmetry. Maxim Raginsky Lecture VIII: Fourier series