EM203/MM283 Tony Holohan S323, x5107, holohana@eeng.dcu.ie www.eeng.dcu.ie/~holohana Week 7 Fourier Series Week 8 Fourier Series Applications Week 9 Fourier Transform Week 10 Fourier Transform Applications Week 11 Z-transform Week 12 Z-transform Applications 1 Fourier Series A function f (t) is called periodic if f (t + T ) = f (t) for all T The period is the smallest such number T Such functions can generally be written as a sum . . . f (t) = a0 + ∞ X an cos(nωt) + bn sin(nωt) n=1 where ω= 2π T The sum of the two terms for n = 1, namely, a1 cos(ωt)+ b1 sin(ωt) is called the fundamental harmonic and the sum of the two terms for n = 2, namely, a2 cos(2ωt)+ b2 sin(2ωt) is called the second harmonic, and so on 2 Optimality How best approximate f (t), with f (t + 2L) = f (t), by a constant? Z +L J= (f (t) − a0 )2 dt −L View f (t) as given. Seek the best possible value for a0 Z +L dJ 2 (f (t) − a0 ) (−1) dt =0= da0 −L Z +L Z +L dt f (t) dt = a0 ⇒ −L −L = a0 t|+L −L = 2La0 Z +L 1 ⇒ a0 = f (t) dt 2L −L 3 Optimality How best approximate f (t), with f (t + 2L) = f (t), by an cos(nωt) ? Z +L J= (f (t) − an cos(nωt))2 dt −L View f (t) as given. Seek the best possible value for an Z +L dJ 2 (f (t) − an cos(nωt)) (− cos(nωt)) dt =0= dan −L Z +L Z +L cos2 (nωt) dt f (t) cos(nωt) dt = an ⇒ −L −L Using cos2 A = Z +L ⇒ −L 1 + cos 2A 2 an f (t) cos(nωt) dt = 2 Z +L (1 + cos(2nωt)) dt −L +L an sin(2nωt) = + L 4nω −L an = + 0, (2nωL = n2π) L Hence, +L 1 ⇒ an = L Z 1 ⇒ bn = L Z f (t) cos(nωt) dt −L Similarly, 4 +L f (t) sin(nωt) dt −L Orthogonality It can be shown that, when n and p are integers, Z +L cos(nωt) cos(pωt) dt = 0 when n 6= p −L Z +L sin(nωt) sin(pωt) dt = 0 when n 6= p −L Z +L sin(nωt) cos(pωt) dt = 0 −L Z +L sin(nωt) dt = 0 −L Z +L cos(nωt) dt = 0 −L In other words, when any two different functions from 1, cos(nωt), sin(nωt), n = 1, 2, . . . are multiplied together and integrated over [−L, +L], the result is zero. 5 Parceval’s Theorem Consider f (t) = a0 + ∞ X an cos(nωt) + bn sin(nωt) n=1 It’s convenient to let b0 = 0. Then f (t) = ∞ X an cos(nωt) + bn sin(nωt) n=0 Multiply both sides by f (t) and integrate over [−L, +L]. +L Z Z 2 f (t) dt = ∞ +L X −L −L f (t) (an cos(nωt) + bn sin(nωt)) dt n=1 Interchange summation and integration Z ∞ Z X +L 2 f (t) dt = −L = f (t) (an cos(nωt) + bn sin(nωt)) −L n=1 ∞ X +L +L Z Z f (t) cos(nωt) dt + bn an f (t) sin(nωt) −L −L n=1 +L giving 1 2L 6 Z ∞ +L 2 f (t) dt = −L a20 1X 2 + an + b2n 2 n=1 Fourier Series - Summary f (t) = a0 + ∞ X an cos(nωt) + bn sin(nωt) n=1 where Z +L 1 f (t) dt a0 = 2L −L Z 1 +L an = f (t) cos(nωt) dt L −L Z 1 +L f (t) sin(nωt) dt bn = L −L Optimality Orthogonality Parceval’s Theorem 1 2L Z ∞ +L 2 f (t) dt = −L Even and odd functions 7 a20 1X 2 + an + b2n 2 n=1 Complex Form Recall that ejθ = cos θ + j sin θ and this easily leads to ejθ + e−jθ cos θ = 2 ejθ − e−jθ and sin θ = 2j Each harmonic can be written in complex form, an cos(nωt) + bn sin(nωt) jnωt ejnωt + e−jnωt e − e−jnωt = an + bn 2 2j a − jb a + jb n n n n + e−jnωt = ejnωt 2 2 Let c 0 = a0 , cn = an − jbn 2 c−n = an + jbn 2 Then an cos(nωt) + bn sin(nωt) = cn ejnωt So a Fourier series can also be written in the form +∞ X f (t) = cn ejnωt −∞ where 1 cn = 2L Z +L f (t)e−jnωt dt −L Then 1 2L 8 Z +L 2 f (t) dt = −L +∞ X n=−∞ |cn |2 Example 1 - The Square Wave Compute the Fourier series of −1 when f (t) = +1 when − 21 < t < 0 0 < t < 21 f (t + 1) = f (t) Z +0.5 1 f (t)e−jnωt dt cn = 2L −0.5 Z 0.5 Z 0 e−jnωt dt e−jnωt dt + =− −0.5 0 0 0.5 e−jnωt e−jnωt =− + −jnω −0.5 −jnω 0 e0 ejnω0.5 e−jnω0.5 e0 =− + + − −jnω −jnω −jnω −jnω 1 = (−2 + 2 cos(nω0.5)) −jnω 2π Since ω = , 1 1 cn = (−2 + 2 cos(nπ)) −jnω 2j (−1 + (−1)n ) nω When n is even, cn = 0. When n is odd, = cn = 9 −2j −4j = nω nπ Example 2 - The Sawtooth Wave Compute the Fourier series of f (t) = t for −1≤t≤1 where f (t + 2) = f (t) ∀t 1 cn = 2L Z +L f (t)e−jnωt dt −L 1 +1 −jnωt = te dt 2 −1 Use integration by parts . . . Z Z u dv = uv − v du Z Let u = t and then du = dt −jnωt Let dv = e e−jnωt and then v = −jnω +1 Z +1 −jnωt e te−jnωt − cn = dt −jnω −1 −1 −jnω +1 te+jnω e−jnωt e−jnω = + − −jnω −jnω (−jnω)2 −1 +1 e−jnω e+jnω e−jnωt = + + −jnω −jnω (nω)2 −1 e−jnω ejnω e+jnω e−jnω = − + + −jnω −jnω (nω)2 (nω)2 10 = 2 cos(nω) 2j sin(nω) + −jnω (nω)2 = 2 cos(nπ) 2j sin(nπ) + −jnπ (nπ)2 But ω = π, 2(−1)n = −jnπ Also, c0 = 0 11 Example 3 - Periodic Train of Pulses The signal f (t) consists of a rectangular pulse of width 2 and of unit area, and is periodic with period T = 1 sec. Compute its Fourier series. f (t) = 1 2 for − ≤ t ≤ + and f (t + 1) = f (t) ∀t 1 cn = 2L Z +L Z f (t)e−jnωt dt −L +0.5 f (t)e−jnωt dt = −0.5 1 = 2 Z + e−jnωt dt − + 1 e−jnωt = 2 −jnω − 1 = 2 e−jnω − ejnω −jnω = 12 sin(nω) nω Since ω = 2π, cn = sin(2nπ) 2nπ Also, c0 = 1 In the limit as → 0, since lim θ→0 sin θ θ then cn → 1 This is a train of impulses, with a periodicity of 1 second. The figures below show various Fourier series finite sums for the square wave and the impulse train. See also the fabulous Fourier Series Approximation utility at www.jhu.edu/~signals 13 Fourier Series - Summary f (t) = +∞ X cn ejnωt n=−∞ where 1 cn = 2L Z +L f (t)e−jnωt dt −L Optimality Orthogonality Parceval’s Theorem 1 2L Z +L f (t) dt = −L Even and odd functions 14 2 +∞ X n=−∞ c2n n=1:100 error 1 error f(t)~ 1 0 −1 −0.5 0 −1 0 0.5 −0.5 n=1 0 −1 0 −1 0 0.5 −0.5 0 n=3 f(t)~ f(t) 1 0 −1 15 0.5 n=1:3 1 −0.5 0.5 n=1:1 1 error f(t)~ 0 error 1 −0.5 n=1:100 0 −1 0 t 0.5 −0.5 0 t 0.5 error n=1:3 n=5 1 f(t)~ error 1 0 −1 −0.5 0 −1 0 0.5 −0.5 n=1:5 0 −1 16 0.5 n=1:5 1 error f(t)~ 1 −0.5 0 error 0 −1 0 t 0.5 −0.5 0 t 0.5 n=0:2 6 2 4 f(t)~ f(t)~ n=0:1 3 1 0 −1 −0.5 0 0 t −2 −0.5 0.5 n=0:3 2 5 0 t n=0:10 0.5 0 t n=1:30 f(t)~ 10 f(t)~ 4 0 −2 −0.5 0 0 t −5 −0.5 0.5 n=1:30 30 f(t)~ 50 10 0 0 −10 −0.5 17 0.5 100 20 f(t)~ 2 0 t 0.5 −50 −0.5 0 t 0.5