EEO 401 Digital Signal Procssing Prof. Mark Fowlr ot St #18 Introduction to DFT (via th DTFT) Rading Assignmnt: Sct. 7.1 of Proakis & Manolakis 1/24
Discrt Fourir Transform (DFT) W v sn that th DTFT is a good analytical tool for D-T signals (and systms as w ll s latr) amly X ( ) n jn (DTFT) can b computd analytically (at last in principl) whn w hav an quation modl for Q: Wll why can t w us a computr to comput th DTFT from Data? A: Thr ar two rasons why w can t!! 1. Th DTFT rquirs an infinit numbr of trms to b summd ovr n =, -3, -2, -1, 0, 1, 2, 3, 2. Th DTFT must b valuatd at an infinit numbr of points ovr th intrval (, ] -Th first on ( infinit # of trms ) isn t a problm if has finit duration -Th scond on ( infinitly many points ) is always a problm!! Wll mayb w can just comput th DTFT at a finit st of points!! 2/24
Lt s xplor this possibility it will lad us to th Discrt Fourir Transform Suppos w hav a finit duration signal: = 0 for n < 0 and n Thn th DTFT of this finit duration signal is: X ( ) n jn 1 n0 jn w can lav out trms that ar zro If w could comput this at vry valu it might look lik this: X () -3-2 - -/2 /2 2 3 W ar only intrstd in this rang Evrywhr ls it just rpats priodically 3/24
ow suppos w tak th numrical data for n = 0,, -1 and just comput this DTFT at a finit numbr of valus (8 points hr but in practic w d do it MAY mor points thousands of points!) X () -3-2 - -/2 /2 2 3 Rgion of Intrst W lav this point out bcaus it is always th sam valu as at =!! 4/24
ow, vn though w ar intrstd in th - to rang, w now play a trick to mak th latr quations asir W don t comput points at ngativ valus X () But, instad comput thir mirror imags at valus btwn and 2 Don t nd sam as = 0-3 -2 - -/2 /2 2 3 So say w want to comput th DTFT at M points, thn choos 2 k k, for k 0,1,2,..., M 1 M Spacing btwn computd valus In othrwords: 2 2 2 0, 1, 2 2,..., M 1 ( M 1) M M M 0 5/24
Thus mathmatically what w hav computd for our finit-duration signal is: X ( k ) 1 n0 jn k 1 n0 jnk 2 M, for k 0,1, 2,, M 1 Thr is just on last stp to gt th official dfinition of th Discrt Fourir Transform (DFT): W must st M = Don for a fw mathmatical rasons latr w ll larn a trick calld zro-padding to gt around this! In othr words: Comput as many frquncy points as signal points So Givn signal data points for n = 0,, -1 Comput DFT points using: X [ k] 1 n0 j2kn / k 0,1,2,..., 1 Dfinition of th DFT 2 k k 6/24
Plotting th DFT (w ll say mor about this latr..) W oftn plot th DFT vs. th DFT indx k (intgrs) X () X [k] = 8 cas Don t nd sam as k = 0 But w know that ths points can b tid back to th tru D-T frquncy : - -/2 0 1 2 3 4 5 6 7 8 k /2 2 3 Spacing btwn computd valus 2 2 8 4 7/24
Invrs DFT Rcall that th DTFT can b invrtd givn X() you can find th signal Bcaus w arrivd at th DFT via th DTFT it should b no surpris that th DFT inhrits an invrs proprty from th DTFT. Actually, w ndd to forc M = to nabl th DFT invrs proprty to hold!! So Givn DFT points X[k] for k = 0,, -1 Comput signal data points using: 1 1 n0 X [ k] j2kn / n 0,1,2,..., 1 Invrs DFT (IDFT) Compar to th DFT a rmarkably similar structur: X [ k] 1 n0 j2kn / k 0,1,2,..., 1 DFT 8/24
DFT Summary What W Know So Far! Givn signal data points w can comput th DFT And w can do this fficintly using th FFT algorithm Givn DFT points w can gt back th signal data points And w can do this fficintly using th IFFT algorithm W know that w can mov th uppr DFT points down to rprsnt th ngativ frquncis this will b ssntial in practical uss of th DFT Rmmbr w ndd up with th uppr DFT points only to mak th indxing by k asy!!! It is just to mak th DFT quation asy to writ!! ow W nd to xplor th connctions btwn th DFT and th DTFT Thn undrstand th rlation btwn th CTFT, DTFT, & DFT 9/24
W can us th DFT to implmnt numrical FT procssing This nabls us to numrically analyz a signal to find out what frquncis it contains!!! sampls FFT algorithm ADC crats stramd computs sampls into mmory DFT valus A CT signal from a snsor & lctronics DFT valus dumpd into mmory ADC x (t) @ F s So w nd to undrstand what th DFT valus tll us about th CTFT of x(t) W nd to undrstand th rlations btwn CTFT, DTFT, and DFT 0] 1] 2] -1] mmory array Computr DFT Procssing (via FFT) H/W or S/W on procssor X[0] X[1] X[2] X[-1] mmory array 10/24
W ll mathmatically xplor th link btwn DTFT & DFT in two cass: 1. For of finit duration: 0 0 0] 1] 2]... X[ 1] 0 0 non-zro trms (of cours, w could hav som of th intrior valus = 0) For this cas w ll assum that th signal is zro outsid th rang that w hav capturd. So w hav all of th maningful signal data. This cas hardly vr happns but it s asy to analyz and provids a prspctiv for th 2 nd cas 2. For of infinit duration or at last of duration longr than what w can gt into our DFT Procssor insid our computr. So w don t hav all th maningful signal data. This is th practical cas. What ffct dos that hav? How much data do w nd for a givn goal? 11/24
DFT & DTFT: Finit Duration Cas If = 0 for n < 0 and n thn th DTFT is: X ( ) n jn 1 n0 jn w can lav out trms that ar zro - ow if w tak ths sampls and comput th DFT (using th FFT, prhaps) w gt: 1 j2kn / X [ k] k 0,1,2,..., 1 n0 2 Comparing ths w s that for th finit-duration signal cas: X [ k] X k X () -/2 X [k] 0 1 2 3 4 5 6 7 /2 2 k DTFT & DFT : DFT points li xactly on th finit-duration signal s DTFT!!! 12/24
Summary of DFT & DTFT for a finit duration X () X [ k] X k 2 Points of DFT ar sampls of DTFT of Th numbr of sampls sts how closly spacd ths sampls ar on th DTFT sms to b a limitation. Zro-Padding Trick Aftr w collct our sampls, w tack on som additional zros at th nd to trick th DFT Procssing into thinking thr ar rally mor sampls. (Sinc ths ar zros tackd on thy don t chang th valus in th DFT sums) If w now hav a total of Z sampls (including th tackd on zros), thn th spacing btwn DFT points is 2/ Z which is smallr than 2/ 13/24
Ex. DTFT & DFT of puls 1, 0, n 0,1,2,...2q othrwis Rcall : 1, p q [ 0, n q,, 1, othrwis 0,1,, q Thn pq[ n q] ot: w ll nd th dlay proprty for DTFT From DTFT Tabl: p q [ P ( ) q sin[( q 0.5) ] sin[ / 2] From DTFT Proprty Tabl (Dlay Proprty): X ( ) sin[( q 0.5) ] sin[ / 2] jq Sinc is a finit-duration signal thn th DFT of th = 2q+1 non-zro sampls is just sampls of th DTFT: X [ k] X k 2 X [ k] sin[( q.5)2k / sin[ k / ] ] jq2k / 14/24
ot that if w don t zro pad, thn all but th k = 0 DFT valus ar zro!!! That dosn t show what th DTFT looks lik! So w nd to us zro-padding. Hr ar two numrically computd xampls, both for th cas of q = 5: For th cas of zropadding 11 zros onto th nd of th signal th DFT points still don t rally show what th DTFT looks lik! For th cas of zropadding 77 zros onto th nd of th signal OW th DFT points rally show what th DTFT looks lik! DFTs wr computd using matlab s fft command s cod on nxt slid 15/24
Comput th DTFT Equation drivd for th puls. Using ps adds a vry small numbr to avoid gtting = 0 and thn dividing by 0 omga=ps+(-1:0.0001:1)*pi; q=5; % usd to st puls lngth to 11 points X=sin((q+0.5)*omga)./sin(omga/2); subplot(2,1,1) plot(omga/pi,abs(x)); % plot magn of DTFT xlabl('\omga/\pi (ormalizd rad/sampl)') ylabl(' X(\Omga) and X[k] ') hold on x=zros(1,22); % Initially fill x with 22 zros x(1:(2*q+1))=1; % Thn fill first 11 pts with ons Xk=fftshift(fft(x)); % fft computs th DFT and fftshift r-ordrs points % to btwn -pi and pi omga_k=(-11:10)*2*pi/24; % comput DFT frquncis, xcpt mak thm % btwn -pi and pi stm(omga_k/pi,abs(xk)); % plot DFT vs. normalizd frquncis hold off subplot(2,1,2) plot(omga/pi,abs(x)); xlabl('\omga/\pi (ormalizd rad/sampl)') ylabl(' X(\Omga) and X[k] ') hold on x=zros(1,88); x(1:(2*q+1))=1; Xk=fftshift(fft(x)); omga_k=(-44:43)*2*pi/88; stm(omga_k/pi,abs(xk)); hold off Mak th zro-paddd signal Comput th DFT Comput th DFT point s frquncy valus and plot th DFT 16/24
Important Points for Finit-Duration Signal Cas DFT points li on th DTFT curv prfct viw of th DTFT But only if th DFT points ar spacd closly nough Zro-Padding dosn t chang th shap of th DFT It just givs a dnsr st of DFT points all of which li on th tru DTFT Zro-padding provids a bttr viw of this prfct viw of th DTFT 17/24
DFT & DTFT: Infinit Duration Cas As w said in a computr w cannot dal with an infinit numbr of signal sampls. So say thr is som signal that gos on forvr (or at last continus on for longr than w can or ar willing to grab sampls) n =, -3, -2, -1, 0, 1, 2, 3, W only grab sampls:, n = 0,, 1 W v lost som information! W can dfin an imagind finit-duration signal: W can comput th DFT of th collctd sampls: X, x [ 0, [ k] n 1 0 x [ n lswhr j2nk / 0,1,2,..., k 1 0,1,..., 1 Q: How dos this DFT of th truncatd signal rlat to th tru DTFT of th full-duration? which is what w rally want to s!! 18/24
"Tru" DTFT : n X ( ) jn What w want to s DTFT of truncatd signal : X ( ) n 1 n0 x [ jn jn A distortd vrsion of what w want to s DFT of collctd signal data : X [ k] 1 n0 j2kn / What w can s DFT givs sampls of So DFT of collctd data givs sampls of DTFT of truncatd signal Tru DTFT DFT of collctd data dos not prfctly show DTFT of complt signal. Instad, th DFT of th data shows th DTFT of th truncatd signal So our goal is to undrstand what kinds of rrors ar in th truncatd DTFT thn w ll know what rrors ar in th computd DFT of th data X ( ) 19/24
To s what th DFT dos show w nd to undrstand how X () rlats to X () First, w not that: x [ p q n q DTFT P ( ) q sin / 2 sin / 2 j( 1) / 2 with =2q+1 From mult. in tim domain proprty in DTFT Proprty Tabl: 1 X ( ) X( ) Pq( ) d 2 causs smaring of X () So X () which w can s via th DFT X [k] is a smard vrsion of X () Fact : Th mor data you collct, th lss smaring bcaus P q () bcoms mor lik () 20/24
Suppos th infinit-duration signal s DTFT is: X () DTFT of infinitduration signal 2 2 Thn it gts smard into somthing that might look lik this: X () DTFT of truncatd signal 2 2 Thn th DFT computd from th data points is: X [k] 2 2 Th DFT points ar shown aftr uppr points ar movd (.g., by MATLAB fftshift ) 21/24
Th only cas that rally happns in practic! Important points for Infinit-Duration Signal Cas 1. DTFT of finit collctd data is a smard vrsion of th DTFT of th infinit-duration data 2. Th computd DFT points li on th smard DTFT curv not th tru DTFT a. This givs an imprfct viw of th tru DTFT! 3. Zro-padding givs dnsr st of DFT points a bttr viw of this imprfct viw of th dsird DTFT!!! 22/24
Connctions btwn th CTFT, DTFT, & DFT x(t) ADC Fs / 2 X ( f ) CTFT Fs / 2 X ()Full Aliasing f DTFT 0] 1] 2] -1] Insid Computr DFT procssing X [0] X [1] X [2] X [-1] Look hr to s aliasd viw of CTFT X () Truncatd Smaring DTFT X [ k] Computd DFT 23/24
Errors in a Computd DFT CTFT DTFT DTFT DFT Aliasing Error control through F s choic (i.. through propr sampling) Smaring Error control through Grid Error control through choic window choic choic zro padding S DSP cours This is th only thing w can comput from data and it has all ths rrors in it!! Th thory covrd hr allows an nginr to undrstand how to control th amount of thos rrors!!! Zro padding trick Collct sampls dfins X () Tack M zros on at th nd of th sampls Tak ( + M)pt. DFT givs points on X () spacd by 2/(+M) (rathr than 2/) 24/24