Lecture 4: Frequency domain representation, DTFT, IDTFT, DFT, IDFT 1 Instructor: Dr. Gleb V. Tcheslavski Contact: gleb@ee.lamar.edu Office Hours: Room 2030 Class web site: http://ee.lamar.edu/gleb/dsp/ind ex.htm ELEN 5346/4304 DSP and Filter Design Fall 2008 2 Some history Jean Baptiste Joseph Fourier was born in France in 1768. He attended the Ecole Royale Militaire and in 1790 became a teacher there. Fourier continued his studies at the Ecole Normale in Paris, having as his teachers Lagrange, Laplace, and Monge. Later on, he, together with Monge and Malus, joined Napoleon as scientific advisors to his expedition to Egypt where Fourier established the Cairo Institute. In 1822 Fourier has published his most famous work: The Analytical Theory of Heat. Fourier showed how the conduction of heat in solid bodies may be analyzed in terms of infinite mathematical series now called by his name, the Fourier series. ELEN 5346/4304 DSP and Filter Design Fall 2008 3 Frequency domain representation Let xn = A cos(ω0 n + ϕ ) − a (co)sinusoidal input (4.3.1) frequency A A A A xn = e j (ω0n+ϕ) + e− j (ω0n+ϕ) = e jϕe jω0n + e− jϕe− jω0n 2 2 2 2 (4.3.2) complex exponent of ω0 complex exponent of -ω0 A sinusoidal signal is represented by TWO complex exponents of opposite frequencies in the frequency domain. ELEN 5346/4304 DSP and Filter Design Fall 2008 4 Frequency domain representation (cont) ⎛ ⎞ Let xn = e jω0 n ⇒ yn = ∑ hk e jω0 ( n − k ) = ⎜ ∑ hk e− jω0 k ⎟ e jω0 n H e jω0 xn k ⎝ k ⎠ jω (4.4.1) The frequency response : H ( e jω ) = ∑ hk e− jωk = H ( e jω ) e k (4.4.2) ( ) ( ) j H e phase magnitude Iff it exists! * ⎛ ⎞ For a real system : H ( e jω ) = ∑ hn e − jωn = ∑ hn*e − jω n = ⎜ ∑ hn e − jωn ⎟ = H * ( e − jω ) n n ⎝ n ⎠ ⇒ H ( e jω ) e ( ) j H e jω = H ( e− jω ) e ⎧ H ( e jω ) = H ( e − jω ) ⎪ ⇒ ⎨ jω − jω ⎪⎩ H ( e ) = − H ( e ) H ( e jω ) has a period of 2π ELEN 5346/4304 DSP and Filter Design Fall 2008 ( − j H e− jω (4.4.3) ) (4.4.4) 5 Frequency domain representation (cont 2) 10 Magnitude (dB) 5 For an arbitrary real LTI system: 0 -5 -10 Symmetric with respect to π -15 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Normalized Frequency (×π rad/sample) 1.6 1.8 2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Normalized Frequency (×π rad/sample) 1.6 1.8 2 Phase (degrees) 100 Anti-symmetric with respect to π 50 0 -50 -100 ELEN 5346/4304 DSP and Filter Design Fall 2008 6 Frequency domain representation (cont 3) Combining (4.3.2) and (4.4.4) – back to our sinusoid! ( ) ( ) A jϕ A e H e jω0 e jω0 n + e − jϕ H e− jω0 e− jω0 n = {real system} 2 2 jω0 j H e − j H ( e jω0 ) − jω n A jϕ A ( ) e jω0 n + e− jϕ H e jω0 e e 0 = e H e jω0 e 2 2 ⎛ j ⎡ω0 n +ϕ + H ( e jω0 ) ⎤⎦⎥ − j ⎡⎣⎢ω0 n +ϕ + H ( e jω0 ) ⎤⎦⎥ ⎞ A = H e jω0 ⎜ e ⎣⎢ +e ⎟ 2 ⎝ ⎠ Stady-state response: yn = ( ( LTI filtering: ) ( ) ) ( ) ( ( yn = A H e jω0 cos ω0 n + ϕ + H e jω0 )) due to the same as from the input the input input change due to the system phase change due to the system Via design, we manipulate H(ejω), therefore, hn, and, finally, manipulate the coefficients in the Linear Constant Coefficient Difference Equation (LCCDE) ELEN 5346/4304 DSP and Filter Design Fall 2008 (4.6.1) (4.6.2) (4.6.3) (4.6.4) 7 Frequency domain representation (cont 4) LCCDE: xn = e jω0 n , n ≥ 0 ⎫ − jω n n ⎬ ytot ,n = ∑ ci λi + ke 0 initial conditions ≠ 0 ⎭ i ytot ,n → ke− jω0 n for large enough n: yn = ∑ hk e jω0 ( n − k ) k (4.7.1) (4.7.2) ⎡ n ⎤ un − k = ⎢ ∑ hk e − jω0 k ⎥ e jω0 n = H (e jω0 )e jω0 n k =0 ⎣ ⎦ (4.7.3) n →∞ H (e jω ) ≤ ∑ hne− jωn = ∑ hn < ∞ − if the system is BIBO, the frequency response exists n (4.7.4) n ELEN 5346/4304 DSP and Filter Design Fall 2008 8 Frequency domain representation (cont 5) for an LTI: xn = e jω0 nun ⇒ yn = ytr ,n + yss ,n (4.8.1) We don’t need systems of order higher than 2: can always make cascades. yss ,n = H (e jω0 )e jω0 n − exists only for LTI , BIBO systems for a real, LTI, BIBO system: xn = A cos(ω0 n + ϕ ) → yss ,n = A H (e jω0 ) cos(ω0 n + ϕ + H (e jω0 ) effects of filtering We cannot observe ANY frequency components in the output that are not present in the input (in steady state). We may see less when H (e jωr ) = 0 ELEN 5346/4304 DSP and Filter Design Fall 2008 (4.8.2) 9 Frequency domain representation (cont 6) In continuous time: xt = st + nt ; {we want} yt = c ⋅ st −τ − distortion − less transmission signal noise ∞ Y ( Ω) = ∫ ye t − j Ωt const ∞ dt = −∞ ∫ c⋅s t −τ (4.9.1) delay e− jΩ (t −τ ) d (t − τ )e− jΩτ = ce− jΩτ S (Ω) = H (Ω) S (Ω) (4.9.2) −∞ We need a constant magnitude and linear phase for the frequencies of interest. Ideal filters: LPF H (e jω0 ) ∠H (e jω0 ) ω HPF BPF H (e jω0 ) H (e jω0 ) π ω BSF ω π π H (e jω0 ) ω π ω π Ideal filters are non-realizable! ELEN 5346/4304 DSP and Filter Design Fall 2008 10 CTFT and ICTFT ∞ CTFT: X (Ω ) = ∫ x(t )e − jωt dt (4.10.1) −∞ ICTFT: x(t ) = 1 2π ∞ ∫ X (Ω )e −∞ Examples: ELEN 5346/4304 DSP and Filter Design Fall 2008 jωt dΩ (4.10.2) 11 DTFT X ( e jω ) = X re ( e ∞ ∑xe ← a complex function, 2π periodic, continuous on ω − jω n n n =−∞ if exists jω ) = X ( e ) cos ( X ( e ) ) , jω jω X im ( e jω ) = X ( e jω ) sin ( X (e ) ) jω X ( e jω ) = X re 2 ( e jω ) + X im 2 ( e jω ) (4.11.1) (4.11.2) 2 (4.11.3) What’s about convergence??? 1. Absolute convergence: < ∞, ⇒ X ( e jω ) converges absolutely or uniformly ∑x if xn ∈ l1 , i.e. n (4.11.4) n Let X k (e jω ) = k ∑xe n =− k − jω n n ⇒ lim X ( e jω ) − X k ( e jω ) = 0 k →∞ (4.11.5) abs . error ELEN 5346/4304 DSP and Filter Design Fall 2008 12 DTFT (cont) Absolutely summable sequences always have finite energy. However, finite energy sequences are not necessary absolutely summable. ⎫ ⎪ 2 a ⎬ are not l1. In fact , they are not l2 : ∑ xn < ∞ n A cos(ω0 n + ϕ ) ⎪⎭ must be un n 2. Mean-square convergence: π lim k →∞ ω ω ∫π X ( e ) − X ( e ) = 0 j j (4.12.1) k − energy of the error The total energy of the error must approach zero, not an error itself! ELEN 5346/4304 DSP and Filter Design Fall 2008 13 IDTFT Let p = 2π is a period , ⇒ X ( e jω ) = ∞ ∑xe n =−∞ 1 1 jω jω n IDTFT: xn = ∫ X (e )e d ω = 2π pp Combining (4.11.1) and (4.12.2) ⎛ 1 xl ⎜ ∑ l =−∞ ⎝ 2π ∞ −j 2π ωn p (4.13.1) n π ∫π X (e jω )e jω n dω (4.13.2) − xn = 1 2π π ⎛ ∞ ⎞ xl e − jωl ⎟ e jωn dω ∫−π ⎜⎝ l∑ =−∞ ⎠ ⎞ ∞ sin [π (n − l )] ∞ jω ( n −l ) ω e d = x xlδ n −l = xn ⎟ ∑ l π (n − l ) = ∑ ∫ −∞ −π ⎠ l =−∞ (4.13.3) π (4.13.4) X ( e jω ) shows where xn “lives” in the frequency domain. ELEN 5346/4304 DSP and Filter Design Fall 2008 14 Back to ideal filters jω 1 H (e ) 0 Ideal LPF: 0 ωc π ω 2π ⎪⎧1, 0 ≤ ω ≤ ωc H LP ( e jω ) = ⎨ ⎪⎩0, ωc < ω < π (4.14.1) Using IDTFT: hLP ,n = 1 2π ωc ∫ e jω n d ω = −ωc 1 ⎛ e jωc n e − jωc n ⎞ sin ωc n − , −∞ < n < ∞ ⎜ ⎟= 2π ⎝ jn jn ⎠ πn (4.14.2) 1. The response in (4.14.2) is not absolutely summable, therefore, the filter is not BIBO stable! 2. The response in (4.14.2) is not causal and is of an infinite length. As a result, the filter in (4.14.1) is not realizable. Similar derivations show that none of the ideal filters in slide 9 is realizable. ELEN 5346/4304 DSP and Filter Design Fall 2008 15 DTFT properties Linearity : ag n + bxn ↔ aG ( e jω ) + bX ( e jω ) (4.15.1) Shift in time : g n − n0 ↔ e − jω n0 G ( e jω ) (4.15.2) Shift in frequency : e− jω0 n g n ↔ G e j (ω −ω0 ) Differenciation : n ⋅ gn ↔ j Linear convolution : g n ∗ xn DTFT DTFT DTFT (4.15.3) dG ( e jω ) (4.15.4) dω ↔ G ( e jω ) ⋅ X ( e jω ) ∞ ∑ n =−∞ (4.15.5) DTFT DTFT ELEN 5346/4304 DSP and Filter Design ) DTFT Periodic convolution : g n ⋅ wn ↔ Parseval ' s theorem : ( 1 2π g n ⋅ w*n = π ω ∫π G ( e )W ( e j j (ω −θ ) ) dθ (4.15.6) − 1 2π π continuous, periodic functions * jω jω ∫ G ( e )W ( e ) dθ (4.15.6) −π Fall 2008 16 DTFTs of commonly used sequences ELEN 5346/4304 DSP and Filter Design Fall 2008 17 DTFT examples Let xn = e jω0 n ↔ X ( e jω ) = 2π ∑ δ (ω − ω0 + 2π k ) (4.17.1) ω0 = 0 ⇒ xn = 1 ↔ X ( e jω ) = 2π ∑ δ (ω + 2π k ) (4.17.2) DTFT k DTFT k un − un −1 = δ n ↔ U ( e jω ) ⋅ (1 − e − jω ) = 1 ⇒ U ( e jω ) = DTFT 1 + c 2π ∑ δ (ω + l 2π ) 1 − e − jω l ½ of DC value of un 1 + π ∑ δ (ω + l 2π ) 1 − e − jω l un ↔ DTFT (4.17.3) (4.17.4) * ⎛ ⎞ ∑n hn*e− jωn = ⎜⎝ ∑n hn e jωn ⎟⎠ = H * ( e jω ) π 1 1 ∑n hn g n e− jωn = ∑n 2π ∫ H ( e jθ ) e jθ n g n e− jωn dθ = 2π −π = 1 2π π θ ∫ H (e ) G (e j j ( ω −θ ) −π ELEN 5346/4304 DSP and Filter Design (4.17.5) π θ ∫π H ( e ) ∑ g e j − j (ω −θ ) n n − dθ n ) dθ (4.17.6) Fall 2008 18 DTFT examples (cont) We can re-work the Parseval’s theorem (4.15.6) as follows: Energy : En = ∑ hn 2 = n 1 2π π π θ θ H ( e θ ) dθ ∫π H ( e ) H ( e ) dθ = 2π ∫π j * j − 1 j − 2 (4.18.1) Sh ( e jω ) energy density (spectrum) Autocorrelation function: rgg ,l = ∑ g n g n −l * = ∑ g n g − (l − n )* = g l ∗ g − l * ↔ G ( e jω ) G * ( e jω ) ≡ S g ( e jω ) n ELEN 5346/4304 DSP and Filter Design n DTFT Fall 2008 (4.18.2) 19 DTFT examples (cont 2) One obvious problem with DTFT is that we can never compute it since xn needs to be known everywhere! which is impossible! Therefore, DTFT is not practical to compute. Often, a finite dimension LTI system is described by LCCDE: N ∑a y i =0 i n−i M = ∑bm xn−m ↔ DTFT m=0 N ∑a e i =0 M Y ( e ) ∑b e ⇒ = jω X ( e jω ) m=0 N Y ( e jω ) = ∑bme− jωm X ( e jω ) M − jωi i − jωm m ∑aie− jωi (4.19.1) m=0 = H (e jω ) practical (finite dimensions) (4.19.2) i =0 Prediction of steady-state behavior of LCCDE ELEN 5346/4304 DSP and Filter Design Fall 2008 How to measure frequency response of an actual (unknown) filter? 20 1. Perform two I/O experiments: ( ( ) ( ) ( ( )) ( )) ⎧1) xn ( c ) = A cos(ω0 n + ϕ ) → yn ( c ) = A H e jω0 cos ω0 n + ϕ + ∠H e jω0 + ytr ,n ( c ) ⎪ LTI ⎨ jω jω (s) (s) (s) ⎪2) xn = A sin(ω0 n + ϕ ) → yn = A H e 0 sin ω0 n + ϕ + ∠H e 0 + ytr ,n LTI ⎩ (4.20.1) (4.20.2) 2. Analyze these measurements and form: ⎧ xn = xn ( c ) + jxn ( s ) = Ae j (ω0 n +ϕ ) ⎪ ⎨ j ⎡⎢ω0 n +ϕ +∠H ( e jω0 ) ⎤⎥ jω (c) (s) ⎦ + ytr ,n ⎪⎩ y n = yn + jyn = A H e 0 e ⎣ j∠H ( e jω0 ) y + ztr ,n Finally ⇒ n = H e jω0 e xn ( ( ) ) That’s a good way to measure/estimate a frequency response for every ω. ELEN 5346/4304 DSP and Filter Design Fall 2008 (4.20.3) (4.20.4) (4.20.5) 21 DFT and IDFT Consider an N-sequence xn (at most N non-zero values for 0 ≤ n ≤ N-1) N −1 X ( e jω ) = ∑ xn e − jω n = ∑ xn e − jω n = X ( e jω ) n =0 n N −1 X k = ∑ xn e DFT: −j n=0 2π kn N ωk = 2π k N = X k , k = 0,1,..., N − 1 (4.21.1) uniformly spaced frequency samples , k = 0,1,..., N − 1 (4.21.2) Finite sum! Therefore, it’s computable. Using notation: WN = e −j 2π N (4.21.3) N −1 X k = ∑ xnWN kn (4.21.1) can be rewritten as: 1 N ⇒ IDFT : xn = (4.21.4) n =0 N −1 ∑X W k n =0 − kn N , n = 0,1,..., N − 1 (4.21.5) Btw, DFT is a sampled version of DTFT. ELEN 5346/4304 DSP and Filter Design Fall 2008 22 DFT and IDFT (cont) Let us verify (4.21.5). We multiply both sides by WN l ⋅n N −1 ∑x W n =0 ⇒ n N l ⋅n N −1 ⎛1 = ∑⎜ n =0 ⎝ N N −1 ∑ xnWN l⋅n = n =0 ∑W n =0 ⇒ − kn N N −1 N −1 k =0 n =0 ⎞ l ⋅n 1 ⎟ WN = N ⎠ N −1 N −1 ∑∑ X W n =0 k =0 k − ( k −l ) n N ∑ X k ∑WN −( k −l ) n − ( k −l ) n N N −1 ∑x W n =0 ELEN 5346/4304 DSP and Filter Design k k =0 1 N N −1 Since N −1 ∑X W n N ⎧ N , for k − l = rN , r is Integer =⎨ ⎩0, otherwise l ⋅n = Xl (4.22.1) (4.22.2) (4.22.3) (4.22.4) Fall 2008 23 FFT X = DN x − DFT x = DN −1 X − IDFT In the matrix form: where: (4.23.1) (4.23.2) x = [ x0 x1 ... xN −1 ] − time domain signal (4.23.3) X = [ X 0 X 1 ... X N −1 ] − N DFT samples (4.23.4) 1 1 ⎡1 ⎢1 W 1 2 W N N ⎢ 2 DN = ⎢1 WN WN 4 ⎢ # # ⎢# ⎢⎣1 WN N −1 WN 2⋅( N −1) (4.23.5) T T ⎤ ⎥ ⎥ 2⋅( N −1) ⎥ − DFT matrix " WN ⎥ % # ⎥ ( N −1)⋅( N −1) ⎥ " WN ⎦ " 1 " WN N −1 1 1 ⎡1 ⎢1 W −1 −2 W N N 1 ⎢ −1 −2 −4 DN = ⎢1 WN WN N⎢ # # ⎢# ⎢⎣1 WN − ( N −1) WN −2⋅( N −1) " 1 ⎤ WN − ( N −1) ⎥⎥ " " WN −2⋅( N −1) ⎥ − IDFT matrix ⎥ % # ⎥ − ( N −1)⋅( N −1) ⎥ −1 " WN ⎦ DN (4.23.6) = This is actually FFT… ELEN 5346/4304 DSP and Filter Design 1 DN * N (4.23.7) Fall 2008 24 Relation between DTFT and DFT 1. Sampling of DTFT Let xn ↔ X ( e jω ) DTFT Sample X ( e jω ) at ω k = 2π { ( ) }=Y k , k = 0,1,...N − 1 ⇒ N frequency samples X e jωk N k − N − point DFT Yk ↔ yn , n = 0,1,..., N − 1 IDFT ⎛ j 2π k ⎞ ∞ Yk = X e jωk = X ⎜ e N ⎟ = ∑ xlWN kl ⎝ ⎠ l =−∞ N −1 N −1 ∞ ∞ 1 1 ⎡1 yn = ∑ YkWN − kn = ∑ ∑ xlWN klWN − kn = ∑ xl ⎢ N k =0 N k =0 l =−∞ l =−∞ ⎣N ( ) Considering (4.22.3) ⇒ yn = ∞ ∑x m =−∞ n + mN (4.24.1) N −1 ∑W k =0 , n = 0,1,..., N − 1 N − k ( n −l ) ⎤ ⎥ ⎦ (4.24.2) (4.24.3) yn is an infinite sum of shifted replicas of xn. Iff xn is a length M sequence (M ≤ N) than yn = xn. Otherwise, time-domain aliasing ⇒ xn cannot be recovered! ELEN 5346/4304 DSP and Filter Design Fall 2008 25 Relation between DTFT and DFT (cont) 2. DTFT from DFT by Interpolation ↔ Let xn be a length N sequence: xn N − point DFT Xk Let us try to recover DTFT from DFT (its sampled version). N −1 X ( e jω ) = ∑ xn e − jω n = n =0 N −1 − j ⎛ ω − 2π k ⎞ n ⎜ ⎟ N⎠ ⎝ Since ∑ e n =0 1 N N −1 ⎡ N −1 ∑ ⎢⎣∑ X W n =0 k =0 k − kn N 1 − e − j ( ω N − 2π k ) e − j ( ω N − 2 π k ) / 2 = = ⋅ 1 − e − j ( ω − 2π k / N ) e − j ( ω − 2π k ) / 2 N n ⎤ − jωn 1 N −1 N −1 j 2π N − jωn = e X e e ∑ ∑ k ⎥ N k =0 n =0 ⎦ (4.25.1) ⎛ ω N − 2π k ⎞ ⎛ ω N − 2π k ⎞ sin ⎜ ⎟ sin ⎜ ⎟ − j ⎜⎛ ω − 2π k ⋅ N −1 ⎟⎞ 2 2 ⎝ ⎠= ⎝ ⎠ ⋅ e ⎝ N 2 ⎠ (4.25.2) ⎛ ω N − 2π k ⎞ ⎛ ω N − 2π k ⎞ sin ⎜ sin ⎟ ⎜ ⎟ 2N 2N ⎝ ⎠ ⎝ ⎠ ⎛ ω N − 2π k ⎞ ⎛ ωN ⎞ sin ⎜ N −1 ⎟ − j ⎛⎜ ω − 2π k ⋅ N −1 ⎞⎟ 1 N −1 sin ⎜ ⎟ 2 ⎝ ⎠ ⎝ 2 ⎠ e− jω 2 N 2 ⎠ (4.25.3) Xk ⋅e ⎝ = ∑ Xk ∑ N k =0 ⎛ ω N − 2π k ⎞ ⎛1⎞ k =0 sin ⎜ sin ⎟ ⎜ ⎟ 2N ⎝ ⎠ ⎝2⎠ j ω It’s possible to determine DTFT X(e ) from its uniformly sampled version uniquely! 1 X (e ) = N jω N −1 ELEN 5346/4304 DSP and Filter Design Fall 2008 26 Relation between DTFT and DFT (cont 2) 3. Numerical computation of DTFT from DFT Let xn is a length N sequence: xn ↔ X ( e jω ) DTFT defined by N uniformly spaced samples We wish to evaluate X ( e jω ) at more dense frequency scale. ωk = 2π k / M , k = 0,1,..., M − 1, where M N ( ) N −1 N −1 n =0 n=0 X e jωk = ∑ xn e − jωk n = ∑ xn e ⎧ xn , ⎩0, Define: xl , n = ⎨ ( − j 2π k n M (4.26.1) 0 ≤ n ≤ N −1 zero-padding N ≤ n ≤ M −1 ) M −1 ⇒ X e jωk = ∑ xl ,n e − j 2π k n =0 n M M −1 = ∑ xl ,nWM kn n =0 No change in information, no change in DTFT… just a better “plot resolution”. ELEN 5346/4304 DSP and Filter Design Fall 2008 (4.26.2) (4.26.3) 27 A note on WN Recall that: WN = e Nth WN is also called an −j 2π N (4.27.1) WN = e root of unity, since −j 2π N ≡1 (4.27.2) Im Im 2π N Re Re 2π n N ELEN 5346/4304 DSP and Filter Design Fall 2008 28 DFT properties 1. Circular shift xn is a length N sequence defined for n = 0,1,…N-1. An arbitrary shift applied to xn will knock it out of the 0…N-1 range. Therefore, a circular shift that always keeps the shifted sequence in the range 0…N-1 is defined using a modulo operation: xc ,n = x( n − n0 ) modulo N = x n − n0 N n0 ≤ n ≤ N − 1 ⎧⎪ xn − n0 , =⎨ ⎪⎩ xN − n0 + n , 0 ≤ n ≤ n0 x n − n0 xn x n −1 = x n +5 6 ELEN 5346/4304 DSP and Filter Design 6 x n−4 = x n+ 2 6 1 N 6 Fall 2008 = N 1 N N −1 ∑X W k =0 N −1 ∑W k =0 N kn0 (4.28.1) X kWN k − k ( n − n0 ) = ↔ WN kn0 N (4.28.2) − kn DFT Xk 29 DFT properties (cont) 2. Circular convolution A linear convolution for two length N sequences xn and gn has a length 2N-1: N −1 yL ,n = ∑ g m xn − m , 0 ≤ n ≤ 2 N − 2 (4.29.1) m=0 A circular convolution is a length-N sequence defined as: N −1 yC ,n = ∑ g m x n − m ≡ g n N m=0 N −1 ∑g m=0 N −1 m x n−m = ∑ g m N m =0 N xn ≡ xn 1 N −1 1 X kWN − k ( n − m ) = ∑ N k = 0 N x n−m N gn (4.29.2) N −1 N −1 ∑∑ g W k =0 m=0 l N km X kWN − kn N 1 N −1 = ∑ Gk X kWN − kn ↔ Gk X k DFT N k =0 Procedure: take two sequences of the same length (zero-pad if needed), DFT of them, multiply, IDFT: a circular convolution. ELEN 5346/4304 DSP and Filter Design (4.29.3) Fall 2008 30 DFT properties (cont 2) Example: X ( e jω ) = ∑ xn e − jω n (4.30.1) n Take N frequency samples of (4.30.1) and then IDFT: xn = 1 N N −1 ∑ X kWN − kn = k =0 = ∑ xl l 1 N N −1 ∑∑ xl e k =0 −j l 2π kl N 2π −j ⎧ ⎫ WN − kn = ⎨WN = e N ⎬ ⎩ ⎭ N −1 1 WN − k ( n −l ) = ∑ xn + rN ∑ N k =0 r ∑δ n−l +rN (4.22.3) (4.30.2) aliased version of xn r The results of circular convolution differ from the linear convolution “on the edges” – caused by aliasing. To avoid aliasing, we need to use zero-padding… ELEN 5346/4304 DSP and Filter Design Fall 2008 31 Linear filtering via DFT Often, we need to process long data sequences; therefore, the input must be segmented to fixed-size blocks prior LTI filtering. Successive blocks are processed one at a time and the output blocks are fitted together… We can do it by FFT: IFFT{FFT{x}FFT{h}}… Problem: DFT implies circular convolution – aliasing! yn = hn ∗ xn (4.31.1) Assuming that hn is an M-sequence, we form an N-sequence: ⎧x xm ,n = ⎨ n ⎩0 mL ≤ n ≤ mL + L − 1 (4.31.2) otherwise N >> M; L >> M; N = L + M - 1 and is a power of 2 ELEN 5346/4304 DSP and Filter Design Fall 2008 32 Linear filtering via DFT (cont) Next, we compute N-point DFTs of xm,n and hn, and form Ym,k = H k X m,k , k = 0,1,...N − 1 Ym ,k → ym ,n IDFT (4.32.1) - no aliasing! Since each data block was terminated with M -1 zeros, the last M -1 samples from each block must be overlapped and added to first M – 1 samples of the succeeded block. An Overlap-Add method. ELEN 5346/4304 DSP and Filter Design Fall 2008 33 Linear filtering via DFT (cont 2) Alternatively: Each input data block contains M -1 samples from the previous block followed by L new data samples; multiply the DFT of the filter’s impulse response and the DFT of the input block, take IDFT. Keep only the last L data samples from each output block. An Overlap-Save method. ELEN 5346/4304 DSP and Filter Design Fall 2008 34 DFT properties: General from Mitra’s book Btw, g[n] = gn ELEN 5346/4304 DSP and Filter Design Fall 2008 35 DFT properties: Symmetry from Mitra’s book xn is a real sequence ELEN 5346/4304 DSP and Filter Design Fall 2008 36 DFT properties: Symmetry (cont) from Mitra’s book xn is a complex sequence ELEN 5346/4304 DSP and Filter Design Fall 2008 37 N-point DFTs of 2 real sequences via a single N-point DFT Let gn and hn are two length N real sequences. Form xn = gn + jhn ↔ Xk (4.37.1) { } 1 X k + X * −k N 2 1 Hk = X k − X * −k N 2j Gk = { Note that X * −k N = X * N −k (4.37.2) } (4.37.3) (4.37.4) N ELEN 5346/4304 DSP and Filter Design Fall 2008 38 Summary Algorithm Time Frequency CTFT Continuous Continuous DTFT Discrete Continuous DFT Discrete Discrete ELEN 5346/4304 DSP and Filter Design Fall 2008