Pusan ational Univrsity Chaptr 6. Th Discrt Fourir Transform and Th Fast Fourir Transform 6. Introduction Frquncy rsponss of discrt linar tim invariant systms ar rprsntd by Fourir transform or z-transforms. In this cas, frquncy rspons bcoms continuous function. For us in this cas, thr is an altrnativ rprsntation calld th discrt Fourir transform(dft) which is discrt in frquncy. Th DFT can b calculatd by computr. Th DFT of a circular convolution of two squncs is th product of thir DFT s In ral practical application, th FFT is usd. Digital Signal Procssing /9
Pusan ational Univrsity 6. Th Discrt Fourir Transform jt X ( j) x( t) dt For a squnc x n = x(nt) dfind for all intgr n, th z-transform is X ( z) x( n) z n (6.) On th unit circl, z = jωt, and z-transform bcoms th Fourir transform of th squnc, jnt X ( jt ) x( n) (6.) n For a finit-lngth squnc x n =,,,, (6.) can b writtn n (6.3) Both (6.) and (6.3) ar continuous functions of frquncy ω. To obtain discrt function of frquncy suitabl for computation, w rplac ω by Ω. Th DFT is dfind as follows: n ( ) X j T x( n) jn T n jnt X ( ) x( n) DFT x( n) (6.), (6.5) Digital Signal Procssing /9
Pusan ational Univrsity Th Ω is frquncy incrmnt in radians pr scond. n How do w choos th frquncy incrmnt Ω? Considr x n =,,,, as on priod of a priodic squnc x n = x nt. Th priod is T scond, which mans that th fundamntal frquncy, orfrquncy rsolution is givn by s (6.6) For brvity, and without loss of gnrality, w can lt T= so that (6.) and (6.6) bcom jn X ( ) x( n), and (6.7) and (6.8) n W shall prov that only distinct valus of X() can b computd. Th modulo function y modulo is dfind as whr r is th largst intgr th magnitud of which dos not xcd [y/]. T (( y)) y r (6.9) (( y)) y r y, if y,, if y r in gnral ( ) jn T X x( n) (6.) Digital Signal Procssing 3/9
Pusan ational Univrsity From th proprtis of th modulo function, th xponnt on th right hand sid of (6.7) can b writtn as jn jn (( )) r jn(( )) jnr jn(( )) ( X ( ) X (( )) (6.) bcaus K < in gnral, thr ar only distinct valus of X(). Thrfor, (6.7) may b writtn jn X ( ) x( n),,,,, (6.3) n This is a squnc of numbrs. From (6.) X ( ) X ( r) (6.) whr r is an intgr ranging from minus infinity to plus infinity, so th DFT can also considrd a priodic squnc of numbrs with priod. Th z-transform of a finit squnc x n =,,,, at points vnly spacd at ω = Ω on th unit circl in th z-plan is DFT x ( n ) X ( z jn ) x j ( n ) (6.5) z n () = r Digital Signal Procssing /9
Pusan ational Univrsity Ex 6.) Find th DFT of th finit squnc n sol) x( n) a, n,,,, a n jn j n X( ) a ( a ) n n j j j ( a ) a j j a a ( a cos jasin ) magnitud ; a M( ) ( a a cos ) phas ; asin ( ) tan a cos Th plot ovr on priod for =9, a=.5 => Digital Signal Procssing 5/9
Pusan ational Univrsity 6.3 Th Invrs Discrt Fourir Transform(IDFT) Th invrs discrt Fourir transform(idft) is usd to map th DFT bac into th squnc in tim domain. Considr first th DFT of a complx sinusoidal squnc of frquncy qω: DFT of x( n) jq n ~ X ( ) jn( q ) n j( q ) j( q ) ⅰ) If q is intgr = q = q r j( q ) j( qqr ), ~ ( ) n () n X ⅱ) If q is intgr ( q ), thn ~ j( q ) j( q ) X, ( ) Thrfor th DFT of ~ X ( ) x( n) jq n, if (( q)), if (( q)) (( q)), Digital Signal Procssing 6/9
If Pusan ational Univrsity Thorm 6. (Invrs DFT) n jn DFT x( n) X ( ) x( n), whr,,,, (6.) thn thr xists an invrs DFT such as ( ) ( ) jm DFT X x m X ( ), m,,, jm jn jm j( mn) proof jm x( m) X ( ) For convninc, th DFT pair ar oftn writtn DFT: IDFT: whr ) W X ( ) x( n) x( n) n n j( mn) X ( ) x( n) W n x( n) X ( ) W j n x(( m)) x( m) ( m n, ),,,, n, n,,, ; frquncy domain ; tim domain (( m)), n Digital Signal Procssing 7/9
Pusan ational Univrsity 6.. Linarity proof) x ( n) a x ( n) a x ( n) X ( ) a X ( ) a X ( ) 3 3 X ( ) x ( n) 3 3 n jn n a x ( n) a x ( n) jn jn ( ) ( ) n n a X ( ) a X ( ) jn a x n a x n Digital Signal Procssing 8/9
Pusan ational Univrsity 6.. Symmtry If x n, n =,,,, is a ral squnc with DFT X(), thn proof) Bcaus X X * ( ) ( ) X ( ) x( n) n jn( ) jn jn X ( ) x( n) x( n) n n n jn x( n) jn * jn * ( ) ( ) ( ) X x n X n Digital Signal Procssing 9/9
Pusan ational Univrsity W conclud from this proprty that Ral part : R{X()}=R{X(-)} Imaginary part : Im{X()}=-Im{X(-)} 3 Magnitud : M()=M(-) Phas : ( ) ( ) It is vidnt from th forgoing that obtain th DFT of a ral - point squnc, it suffics to comput ( + )/ or (/ + ) frquncy sampls for odd or vn, rspctivly. Th finit squnc x(n) can b considrd to b on priod of a priodic function with priod i) Evn function cas x x vn function M M n n ⅱ) Odd function cas x x odd function l n n Digital Signal Procssing /9
Pusan ational Univrsity 6..3 Circular Shifting If x n, n =,,,, is a finit squnc, thn th circular shift of this squnc by n sampls, say has maning only if w considr x n as on priod of priodic squnc x n = x n. W shift x n through n sampls and rcovr th shiftd finit squnc x s (n) by multiplying x (n n by th rctangular window squnc, n R ( n), othrwis if x ( n) x(( n n )) R ( n) s whr, X ~ ( ) DFT x ( n ) jn DFT x ( n) X ( ) R ( ) R s, ( ), othrwis ~ Digital Signal Procssing /9
proof) whr Pusan ational Univrsity DFT x( n n ) x( n n ) n jn jn j( nn) ( ) n x n n jn ( ) ( ) n jm DFT x n n x m mn whr, m=r- (considr priodic function) n n jm jm jm x( m) x( m) x( m) mn mn m jm j( r ) m n n x( m) x( r ) mn r n Digital Signal Procssing /9
Pusan ational Univrsity Bcaus is priodic x( r ) x( r) j( r ) jr j Also, ( ) jm jr x( m) x( r) mn r n Rplac th indx r by m n n jm jm jm x( m) x( m) x( m) mn m n m m jm x( m) X ( ) Thrfor n jn jm jn DFT x( n n ) x( m) X ( ) s xr () or X X jn ( ) ( ) mn whr X s is th priodic xtnsion of X s. ow X X R X R jn ( ) ( ) ( ) ( ) ( ) s s x( n) jq n n n jm jm jm x( m) x( m) x( m) mn mn m Digital Signal Procssing 3/9
Pusan ational Univrsity 6.. Circular Convolution Instad of a linar convolution of two squncs, w hav a circular convolution. A circular convolution of two -point squncs x(n) and h n is dfind as y( n) x( m) h(( n m)) R ( n) m x( n) nh(( n)) Ex 6.) Find, graphically, th circular convolutions of th two finit squncs, n, xn ( ), othrwis n a, n,,,, a.9, 5 hn ( ), othrwis Digital Signal Procssing /9
Pusan ational Univrsity y( n) x( m) h(( n m)) R ( n) m y() x() h() x() h( ) x() h( )..5.9 y() x() h() x() h() x() h( ).. y() x() h() x() h() x() h().8.8 Digital Signal Procssing 5/9
Pusan ational Univrsity Thorm 6.( Convolution Thorm for DFTs) If Y ( ) H ( ) X ( ) y( n) x( m) h(( n m)) R ( n) m h( m) x(( n m)) R ( n) m proof) W hav X ( ) x( m) m H ( ) h( l) l jm jl 이고 y(( n)) DFT Y ( ) Y ( ) jn Digital Signal Procssing 6/9
Pusan ational Univrsity Thn th priodic squncs y(( n)) DFT Y ( ) Y( ) m X ( ) H ( ) jn jn x( m) h( l) m l j( nml) x( m) h( l) jm jl jn m l x( m) h(( n m)) j( nml) (( nm)), l It follows that th -point squnc y( n) y(( n)) R ( n) m x( m) h(( n m)) R ( n) Digital Signal Procssing 7/9
Pusan ational Univrsity 6.7 Th Fast Fourir Transform Th amount of computation of th DFT of complx squnc f(nt) jnt F( ) f ( nt),,,, n (6.65) Whn a complx multiplication is carrid out, it rquirs four ral multiplication and two ral addition. A complx addition rquirs two ral additions. On opration: a complx multiplication plus a complx addition(that is, four ral multiplication and four ral additions) ( AB ( a jb)( c jd) ( ac bd) j( bc ad), Th calculation of nds oprations. If w us FFT and is a powr of, FFT mas log oprations Ex) = =, A B ( a c) j( b d) ) F ( ) FFT brings a saving of 99% oprations. DFT: 6 opration, FFT : opration Digital Signal Procssing 8/9
Pusan ational Univrsity To calculat FFT, data numbr should b a powr of. jn jnt Two approachs for FFT calculation X ( ) x( n) x( n) n n Dcimation in Tim : th squnc for DFT is succssivly dividd up into smallr squncs, and th DFTs of ths subsquncs ar combind in a crtain pattrn to yild th rquird DFT of th ntir squncs with th much fwr oprations. To rduc oprations, w us th symmtry and priodic charactristic of W n j( ) n Dcimation in Frquncy : th frquncy sampls of th DFT ar dcomposd into smallr and smallr subsquncs in a similar mannr. Th DFT of -point signal f(nt) n F fnw,,,, n whr W = jπ/ = jω on = b. Ex) If w considr th DFT of a squnc of /, thn Wwould b rplacd by W, and th summation limit would b /-. n / / j( ) n ( j( ) n) n W W T Digital Signal Procssing 9/9
Pusan ational Univrsity 6.7. Dcimation in Tim Th squnc f n is first dividd into two shortr intrwovn squncs, g n and h n g f, n,,, ( vn numbrd) n n h f, n,,, ( odd numbrd) n n F( ) f W,,,, n n 8points DFT f n is dividd as g n and h n points DFT n n n G g W n n( ),,,, H h W n n( ),,,, Digital Signal Procssing /9
Pusan ational Univrsity W can xprss th DFT of th ntir squnc F in trms of G and H n n (n) n n n n n F f W g W h W n n gnw W hnw n n G W H,,,, n (n) n n n ( F f W f W, j j / W W ) G and H hav priod /, hnc w may writ as follows: G W H, F G W H, n / ( / ) (whr, W ) / / / G g W g W W g W G G n ( ' ) ( ) n n ( n ) n n n n n n G G, as sam way, H H Digital Signal Procssing /9
Pusan ational Univrsity As th forgoing rduction is carrid out, G and H rquir on th ordr of (/) oprations ach, and oprations ar rquird for multiplying H by W and adding W H to G. This givs a total of approximatly + (/) oprations compard with of oprations for dirct valuation of th DFT. ( ) F G W H, G W H, G G G G W H W H W H 3 3W H3 G G G G W H W H 5 W H 6 W H 7 3 3 Digital Signal Procssing /9
Pusan ational Univrsity To procd with this mthod, th / point squncs g n and h n ar both dcomposd into two / point squncs by taing th vn- and odd- numbrd sampls, as was don with f n Thus, p g, n,,, n n q n gn n,,,, r h, n,,, n n s n hn n,,,, By th sam rasoning as for th first stag, it follows that n n (n) n n n n n G g W p W q W P W Q, P W Q, Digital Signal Procssing 3/9
Pusan ational Univrsity whr P, Q, R, and S ar th / DFTs of p n, q n, r n, and s n, rspctivly. Th total numbr of oprations for F is now rducd to approximatly whr H R W S,, R W S (/) + + =(/) + n P p ( W ),, n n n n( ) n P p W p pw n n( ) n P p W p p W Digital Signal Procssing /9
Pusan ational Univrsity Total oprations G P W Q, P W Q, ( / ) H R W S,, R W S P Q W p pw p pw P QW G G W H W H G W H r r rw rw R R W S W S G W H R R W S W S 6 G G W H 6 W H 7 3 3 Digital Signal Procssing 5/9
Pusan ational Univrsity P p n n W n f fw P W Q ( ),, G P W Q,, P W Q G W H f f W G P W Q G W H f 6 f W G P W Q G W H f 6 f W P W Q 6 G W H 3 3 3 f 5 f W R W S G W H f 5 f W R W S G W H 5 f 3 7 f W R W S G W H 6 f 3 7 f W R W S 6 G W H 7 3 3 Digital Signal Procssing 6/9
Pusan ational Univrsity Th procss nds whn th original -point squnc f n is dividd up into -point squncs with -point DFT computd for ach. Ths ar combind in an appropriat mannr to yild F. FFT Whn th DFT computation of th powr-of--lngth squnc has bn compltly rducd to a combination of complx multiplications and additions, th ultimat saving in computation is achivd approximatly to log oprations v v log v log For th 8-point xampl, 3 stps ar rquird to rach this stag, and th oprations ar combind as shown in Fig. 6.. Th rsulting numbr opration is about log = as compard with th = 6 8 6 Using MATLAB X=fft(x, ) Digital Signal Procssing 7/9
Pusan ational Univrsity From Fig. 6., it is vidnt that th output squnc is in natural ordr F, F, F, F 3, F, F 5, F 6, F 7 -whras th input squnc is not. Th input squnc is f, f, f, f 6, f, f 5, f 3, f 7 is in bit rvrsd ordr. Using MATLAB X=fft(x, ) Digital Signal Procssing 8/9
Pusan ational Univrsity Exampl of FFT using MATLAB Fs = ; % Sampling frquncy T = /Fs; % Sampl tim L = ; % Lngth of signal t = (:L-)*T; % Tim vctor % Sum of a 5 Hz sinusoid and a Hz sinusoid x =.7*sin(*pi*5*t) + sin(*pi**t); y = x + *randn(siz(t)); % Sinusoids plus nois plot(fs*t(:5),y(:5)) titl('signal Corruptd with Zro-Man Random ois') xlabl('tim (millisconds)') Digital Signal Procssing 9/9
Pusan ational Univrsity FFT = ^nxtpow(l); % xt powr of from lngth of y Y = fft(y,fft)/l; f = Fs/*linspac(,,FFT/+); % Plot singl-sidd amplitud spctrum. plot(f,*abs(y(:fft/+))) titl('singl-sidd Amplitud Spctrum of y(t)') xlabl('frquncy (Hz)') ylabl(' Y(f) ') Digital Signal Procssing 3/9
Pusan ational Univrsity 6.7. Dcimation in Frquncy To illustrat th dcimation frquncy, th squnc is dividd into two squncs g n and h n, whr g n contains th first / sampls of f n, and h n contains th rmaining sampls. Thus g f, n,,, / n n h f, n,,, / n n / Thn th -point DFT of f n is / / / n n n n ( n / ) n n n n n n n n / n n F f W f W f W g W h W / n gn ( ) h nw,,,, n / ( j / ) / j ( W ) W / j Digital Signal Procssing 3/9
Pusan ational Univrsity ow divid th squnc F into th vn-numbrd and th odd-numbrd sampls (this accounts for th trm dcimation-in-frquncy) i) For th vn-numbrd frquncis / ( n n) n,,,, / n F g h W ii) For th odd-numbrd frquncis : / F ( g h ) W n n n / n () n n n ( gn hn) W ( W ),,, Digital Signal Procssing 3/9
Pusan ational Univrsity / ( n n) n,,,, / n F g h W Similarly, w can subdivid ach / point DFT into two /- point DFTs and continu until finally w hav -point DFTs Th complt procss is illustratd for = 8 in Fig. 6. 5. Th output squnc is in bit-rvrsd ordr for input in natural ordr. Digital Signal Procssing 33/9
Pusan ational Univrsity 6.8 Us of th Discrt Fourir Transform for digital Filtr Dsign 6.8. Introduction Suppos that an th-ordr filtr is spcifid, with a dsird frquncy rspons H(jωT). Ta qually spacd sampls H, =,,, of this frquncy charactristic about th unit circl, or sampl at intrvals of Ω = π/t along th frquncy axis. Thr altrnativ approachs ar now fasibl.. Ta th IDFT with H = H() to obtain th finit puls rspons h(n), n =,,,. Thn, obtain th filtr output for a givn input squnc x n by linarly convolving x n with h n. y( n) x( n)* h( n). A scond mthod is to carry out th filtring ntirly in th frquncy domain by using th frquncy sampls, H. 3. Th trm frquncy sampling is gnrally applid to th third mthod, by which w s a continuous frquncy charactristic to approximat th dsird rspons H(jωT) by using th sampls H. H ( z) hn z n n Digital Signal Procssing 3/9
Pusan ational Univrsity 6.8. Filtring ntirly in th Frquncy Domain Us an FFT algorithm to ta an -point DFT of th discrt signal x(n) to b filtrd. Multiply th rsulting frquncy sampls X = X() by vnly spacd sampls H of th dsird filtr rspons H(jωT). 3 Th output Y = H X() is transformd to th tim domain by taing th IDFT via an FFT algorithm Digital Signal Procssing 35/9
Pusan ational Univrsity 6.8.3 Frquncy Sampling This mthod uss th DFT to produc a finit puls rspons filtr that has a continuous frquncy rspons that is qual to th dsird frquncy rspons H(jωT) at th qually spacd frquncy sampling instancs Ω, =,,, and approximats th dsird rsponss btwn sampling instancs. Lt j H M Ta th IDFT of H to gt th unit puls rspons jn hn H, n,,, Stting a = jω for convninc, th transfr function of th filtr is H ( z) h z H a z n n n n n n n ( az ) H ( a z ) H n n a z j z z H H az az Digital Signal Procssing 36/9
Pusan ational Univrsity It is vidnt that th zros from z cancl th pols z = a, so w ar lft with whr, from zro z ( z ) z ( ) H ( z) H H z z a z z a ji i ai i i z a i i H( z) H ( z a ) / z, j j j j z z a j j z ( z a ) i i z z a This is similar to th moving avrag filtr and modifid comb filtr. z ( z ai ) T Digital Signal Procssing 37/9
Pusan ational Univrsity H() z H z a z To gt th frquncy rspons of th filtr, lt a = jω and T=. Th frquncy rspons is obtaind as follows: j j ( ) H ( jt ) H H j j j( ) j / This indicats that th frquncy rspons is th linar combination of th frquncy sampls H with frquncy intrpolation of th form sin ( ) / s( ) => Oscillation sin ( ) / j ( )/ sin ( ) / H j( )/ sin ( ) / j / j j / j( ) H H j ( ) sin ( ) / sin ( ) / sin ( ) / sin ( ) / Digital Signal Procssing 38/9
Pusan ational Univrsity 6.8. Filtr Dsign by th Frquncy Sampling Mthod This implis that th frquncy rspons sampls H =DFT[h n ] must satisfy th symmtry rquirmnt * H H M M l ⅰ) is odd numbr H,,,, ⅱ) is vn numbr H,,,, If th filtr is to b linar phas, thn h n must also satisfy th symmtry rquirmnt hn h n with constant phas dlay j j jn H M 일때 hn M, n,,, h * n (6.9) Digital Signal Procssing 39/9
Pusan ational Univrsity * * n n n DFT h h n n m * j( n) j( n) n * jm j( ) hm, ( m n ) * j( n) h H * * j( ) jn n jn h H M j j( ) * * j j ( H M M ) jn (6.95) (6.97) Digital Signal Procssing /9
Pusan ational Univrsity Using (6.9) and (6.97) j j( ) jn j jn M M j j( ) j ( ) If is substitutd for - ( ) ( ) ) Digital Signal Procssing /9
Pusan ational Univrsity Thrfor th unit puls rspons is givn by j jn hn M n whr n n hn ( ) M n j p M M ( ) M, for odd whr, p, for vn n n j j ( ) Digital Signal Procssing /9
Pusan ational Univrsity Thn, n n j ( ) j p (n ) hn M ( ) M cos. odd M M,,,, p (n ) hn M ( ) M cos Digital Signal Procssing 3/9
Pusan ational Univrsity. vn,,,, M M,,,, M p (n ) hn M ( ) M cos Also, j( ) / H M p j( ) / H M,,,,, (6.5),,, p (6.6) Digital Signal Procssing /9
Pusan ational Univrsity If is vn, H Using (6.8), H(z) is drivd as H ( z) z H j z p j( ) / p j( ) / z M M M j j( ) z z z p ( ) M cos( )( ) z z M H( z) z cos( ) z z (6.3) Sustituting Frquncy rspons is obtaind as ( ) T j T ( ) M cos cos T H j T z j T sin ( ) ( ) T sin p ( ) M cos( / ) cos / cost Digital Signal Procssing 5/9
Pusan ational Univrsity 6.8.6 Exampl Ex 6.) Dsign linar phas lowpass digital filtr with gain approximatly unity in th passband and zro in th stopband. And f 8Hz f Hz, 5 Sol) c Bcaus th cut off frquncy is th dsird magnitud rspons ar To mt symmtry rquirmnts From (6.5)and (6.6), th rquird frquncy rspons is s s 8 rad / s, T 5 H = M j( ), =,,, p (6.5) H = M j( ), =,,, p (6.6) c M 6, M c,, 3,, 3, 3 j 5, H ( ), 3 j, 3, Digital Signal Procssing 6/9
Pusan ational Univrsity From (6.3) H() z 5 z.937 z z.756 z z 5 z.98( z ).937( z ) Digital Signal Procssing 7/9
Pusan ational Univrsity Frquncy rspons jt sin.5t H ( jt ) (cos cos T 5 sin.5t.99.9686 ( ).9686 cost.8763 cost Th situation can b improvd if, instad of spcifying that th rspons sampls go dirctly from unity in th passband to zro in th stopband, w allow in a transition rgion as follows: H H j / 5, j / 5.5, 3, j / 5.5, j / 5, 3, Digital Signal Procssing 8/9
Pusan ational Univrsity Th rsult of adding th transition sampls is shown in Fig. 6.8 Digital Signal Procssing 9/9