EI331 Signals and Systems Lecture 13 Bo Jiang John Hopcroft Center for Computer Science Shanghai Jiao Tong University April 9, 2019
Contents 1. Fast Fourier Transform 2. DT Filters 3. CT Fourier Transform 1/36
Discrete Fourier Transform (DFT) DTFS pair for N -periodic DFT pair for finite sequence sequence of length N Analysis equation DFT N − 1 x [ k ] = 1 � x [ n ] e − jk 2 π N n ˆ � x [ n ] e − jk 2 π N n X [ k ] = N n ∈ [ N ] n = 0 Synthesis equation Inverse DFT N − 1 � x [ k ] e jk 2 π N n x [ n ] = 1 x [ n ] = ˆ X [ k ] e jk 2 π � N n N k ∈ [ N ] k = 0 Both pairs of equations essentially the same up to constant factor 1 N ; efficient computation by Fast Fourier Transform (FFT) 2/36
DFT in Matrix Form With W N = e − j 2 π N (note sign change from last lecture) W 0 W 0 W 0 W 0 W 0 W 0 W 0 W 0 X [ 0 ] x [ 0 ] 8 8 8 8 8 8 8 8 W 0 W 1 W 2 W 3 W 4 W 5 W 6 W 7 X [ 1 ] x [ 1 ] 8 8 8 8 8 8 8 8 W 0 W 2 W 4 W 6 W 0 W 3 W 4 W 6 X [ 2 ] x [ 2 ] 8 8 8 8 8 8 8 8 X [ 3 ] W 0 W 3 W 6 W 1 W 4 W 7 W 2 W 5 x [ 3 ] 8 8 8 8 8 8 8 8 = W 0 W 4 W 0 W 4 W 0 W 4 W 0 W 4 X [ 4 ] x [ 4 ] 8 8 8 8 8 8 8 8 W 0 W 5 W 2 W 7 W 4 W 1 W 6 W 3 X [ 5 ] x [ 5 ] 8 8 8 8 8 8 8 8 W 0 W 6 W 4 W 2 W 0 W 6 W 4 W 2 X [ 6 ] x [ 6 ] 8 8 8 8 8 8 8 8 W 0 W 7 W 6 W 5 W 4 W 3 W 2 W 1 X [ 7 ] x [ 7 ] 8 8 8 8 8 8 8 8 Direct matrix multiplication has complexity O ( N 2 ) FFT is divide-and-conquer algorithm (Cooley & Tukey 1965) 3/36
Fast Fourier Transform (FFT) Divide and conquer Assume N = 2 M (radix 2). Divide x into two subsequences n = 0 , 1 , . . . , 2 M − 1 − 1 x e [ n ] = x [ 2 n ] , n = 0 , 1 , . . . , 2 M − 1 − 1 x o [ n ] = x [ 2 n + 1 ] , N -point DFT X of x . For k = 0 , 1 , . . . , 2 M − 1 , 2 M − 1 x [ n ] e − jk 2 π � 2 M n X [ k ] = n = 0 2 M − 1 − 1 2 M − 1 − 1 2 M 2 n + x e [ n ] e − jk 2 π x o [ n ] e − jk 2 π � � 2 M ( 2 n + 1 ) = n = 0 n = 0 2 M − 1 − 1 2 M − 1 − 1 2 M − 1 n + e − jk 2 π 2 π 2 π � � x e [ n ] e − jk x o [ n ] e − jk 2 M − 1 n = 2 M n = 0 n = 0 4/36
Fast Fourier Transform (FFT) Divide and conquer Divide X into two halves. For k = 0 , 1 , . . . , 2 M − 1 − 1 2 M − 1 − 1 2 M − 1 − 1 2 M − 1 n + e − jk 2 π 2 π 2 π � � x e [ n ] e − jk x o [ n ] e − jk 2 M − 1 n X [ k ] = 2 M n = 0 n = 0 2 M − 1 − 1 2 M − 1 − 1 2 M − 1 n − e − jk 2 π X [ 2 M − 1 + k ] = 2 π 2 π � � x e [ n ] e − jk x o [ n ] e − jk 2 M − 1 n 2 M n = 0 n = 0 N N 2 -point DFT of x e 2 -point DFT of x o Recursive algorithm DFT( x )[ k ] = DFT( x e )[ k ] + e − jk 2 π N DFT( x o )[ k ] DFT( x )[ 2 M − 1 + k ] = DFT( x e )[ k ] − e − jk 2 π N DFT( x o )[ k ] 5/36
Fast Fourier Transform (FFT) Naive implementation of radix-2 FFT for N = 2 M 6/36
Fast Fourier Transform (FFT) Time complexity Denote by T ( N ) time complexity of N -point FFT � N � T ( N ) = 2 T + O ( N ) 2 Let ˜ T ( M ) = T ( 2 M ) and assume O ( N ) = cN for contant c , T ( M − 1 ) + c 2 M = T ( M ) = 2 ˜ ˜ ⇒ ˜ T ( M ) = O ( M 2 M ) or T ( N ) = O ( N log N ) Much lower than O ( N 2 ) for direct matrix multiplication! 7/36
Contents 1. Fast Fourier Transform 2. DT Filters 3. CT Fourier Transform 8/36
Frequency Response Recall response of DT LTI system to exponential input z n �� � � a k z n a k H ( z k ) z n = T k k k k where H ( s ) is system function ∞ � h [ n ] z − n H ( z ) = n = −∞ When restricted to z = e j ω , H ( e j ω ) as function of ω is called frequency response of the system ∞ � H ( e j ω ) = h [ n ] e − j ω n n = −∞ 9/36
Frequency Response Periodic input x in Fourier series representation where ω 0 = 2 π � x [ k ] e jk ω 0 n , x [ n ] = ˆ N . k ∈ [ N ] Output of LTI system with frequency response H ( e j ω ) � � x [ k ] e jk ω 0 n = H ( e jk ω 0 )ˆ x [ k ] e jk ω 0 n y [ n ] = T ˆ k ∈ [ N ] k ∈ [ N ] periodic with same periodic, Fourier coefficients related by y [ k ] = H ( e jk ω 0 )ˆ ˆ x [ k ] 10/36
Filtering Filtering changes relative amplitudes of frequency components or eliminates some frequency components entirely Frequency-shaping vs frequency-selective filters as in CT case LTI systems as filters • cannot create new frequency components • can only scale magnitudes or shift phases of existing components Examples of nonlinear filter • max filter: y [ n ] = − n 1 ≤ k ≤ n 2 x [ n + k ] max • median filter: y [ n ] = median { x [ n − n 1 ] , . . . , x [ n + n 2 ] } Recall for DT signals, suffices to consider frequencies on an interval of length 2 π , e.g. [ 0 , 2 π ) or ( − π, π ] 11/36
High vs. Low Frequencies for DT Signals High frequencies around ( 2 k + 1 ) π , low frequencies around 2 k π x x x n n n φ 0 φ 1 φ 2 N [ n ] = cos( 0 · n ) = 1 N [ n ] = cos( π n / 4 ) N [ n ] = cos( π n / 2 ) x x x n n n φ 3 φ 4 φ 5 N [ n ] = cos( 3 π n / 4 ) N [ n ] = cos( π n ) N [ n ] = cos( 5 π n / 4 ) x x x n n n φ 6 φ 7 φ 8 N [ n ] = cos( 3 π n / 2 ) N [ n ] = cos( 7 π n / 4 ) N [ n ] = cos( 2 π n ) = 1 12/36
DT Frequencies Discrete frequencies of N -periodic signals • evenly spaced points on unit circle • low frequencies close to 1 ; high frequencies close to − 1 Im Im e j 1 2 π e j 2 2 π 5 8 e j 3 2 π e j 1 2 π 8 8 e j 2 2 π 5 e j 0 2 π e j 0 2 π 8 5 high high low low Re Re e j 4 2 π 8 e j 3 2 π 5 e j 5 2 π e j 7 2 π 8 8 e j 6 2 π e j 4 2 π 8 5 N = 8 N = 5 13/36
Ideal Frequency-selective Filters Ideal lowpass filter � 1 , | ω | ≤ ω c H ( e j ω ) = 0 , ω c < | ω | ≤ π ω c : cutoff frequency H ( e j ω ) 1 ω − π − ω c − 2 π 0 ω c π 2 π 14/36
Ideal Frequency-selective Filters Ideal highpass filter � 1 , ω c ≤ | ω | ≤ π H ( e j ω ) = 0 , | ω | < | ω c | ω c : cutoff frequency H ( e j ω ) 1 ω − π − ω c − 2 π 0 ω c π 2 π 15/36
Ideal Frequency-selective Filters Ideal bandpass filter � 1 , ω c 1 ≤ | ω | ≤ ω c 2 H ( e j ω ) = 0 , | ω | < ω c 1 or ω c 2 < | ω | ≤ π ω c 1 : lower cutoff frequency ω c 2 : upper cutoff frequency H ( e j ω ) 1 ω − π − ω c 2 − ω c 1 − 2 π 0 ω c 1 ω c 2 π 2 π 16/36
First-order Recursive DT Filters y [ n ] − ay [ n − 1 ] = x [ n ] For input x [ n ] = e j ω n , output y [ n ] = H ( e j ω ) e j ω n Frequency response (well-defined if | a | < 1 ) 1 H ( e j ω ) = 1 − ae − j ω , | a | < 1 For a = | a | e j φ , 1 | H ( e j ω ) | = 1 + | a | 2 − 2 | a | cos( ω − φ ) � arg H ( e j ω ) = arctan −| a | sin( ω − φ ) 1 − | a | cos( ω − φ ) 17/36
First-order Recursive DT Filters For a > 0 , lowpass filter For a < 0 , highpass filter (exponential smoothing) a = 0 . 3 a = − 0 . 3 | H ( e j ω ) | | H ( e j ω ) | a = 0 . 6 a = − 0 . 6 2 2 1 1 ω ω − π − π 0 π 0 π arg H ( e j ω ) arg H ( e j ω ) π π 2 2 − π ω ω − π π π − π − π 2 2 18/36
First-order Recursive DT Filters s Impulse response (IIR filter) a = 0 . 6 h [ n ] = a n u [ n ] ∞ 1 n ( ae − j ω ) n = � H ( e j ω ) = s 1 − ae − j ω a = 0 . 3 n = 0 Need | a | < 1 for convergence n Step response s a = − 0 . 6 s [ n ] = ( h ∗ u )[ n ] = 1 − a n + 1 1 − a u [ n ] Tradeoff n • larger | a | , narrower passband, s a = − 0 . 3 slower response • smaller | a | , faster response, n broader passband 19/36
Moving Average as Lowpass Filter M 2 1 � y [ n ] = x [ n − k ] M 1 + M 2 + 1 k = − M 1 Impulse response (FIR filter) M 2 1 � h [ n ] = δ [ n − k ] M 1 + M 2 + 1 k = − M 1 Frequency response e j M 1 − M 2 M 2 sin( M 1 + M 2 + 1 ω ω ) 1 e − jk ω = 2 � H ( e j ω ) = 2 sin ω M 1 + M 2 + 1 M 1 + M 2 + 1 2 k = − M 1 20/36
Moving Average as Lowpass Filter M 1 = 0 , M 2 = 1 , y [ n ] = 1 2 ( x [ n ] + x [ n − 1 ]) h [ n ] = 1 2 ( δ [ n ] + δ [ n − 1 ]) 2 cos ω H ( e j ω ) = e − j ω 2 | H ( e j ω ) | 1 ω − π − 2 π 0 π 2 π Verify y = x if x = Ke j 0 · n and y = 0 if x = Ke j π n = K ( − 1 ) n . 21/36
Moving Average as Lowpass Filter M 1 = M 2 = 1 , y [ n ] = 1 3 ( x [ n + 1 ] + x [ n ] + x [ n − 1 ]) h [ n ] = 1 3 ( δ [ n + 1 ] + δ [ n ] + δ [ n − 1 ]) H ( e j ω ) = sin( 3 2 ω ) = 1 3 + 2 3 cos ω 3 sin ω 2 | H ( e j ω ) | 1 ω − π − 2 π − 2 π 0 2 π π 2 π 3 3 22/36
Moving Average as Lowpass Filter e j M 1 − M 2 sin( M 1 + M 2 + 1 ω ω ) 2 H ( e j ω ) = 2 sin ω M 1 + M 2 + 1 2 | H ( e j ω ) | 1 M 1 + M 2 + 1 = 11 2 π M 1 + M 2 + 1 ω − π 0 π | H ( e j ω ) | 1 M 1 + M 2 + 1 = 41 ω − π 0 π Larger M 1 + M 2 , narrower passband, smoother output 23/36
Recommend
More recommend