You are on page 1of 39

# 1

IV Discrete –Time Fourier transform DTFT. A. Basic Definitions The discrete-time Fourier transform (DTFT) of x(n) is X(ejw) = ∑ x(n) e-jwn where w is in radians. X(ejw) is periodic with period 2π, since a function of a periodic function is periodic, and has the same period. Since the forward transform is a Fourier series, the inverse transform, x(n) = 1/2π ∫ X(ejw) ejwn dw is the formula for the Fourier series coefficient. The frequency response H(ejw) is the DTFT of the impulse response h(n). As with the continuous-time

2

Fourier transform, the DTFT is used because of the existence of a convolution theorem. Amplitude and Phase of DTFT. X(ejw) = Re { X(ejw) } + j Im { X(ejw) } = | X(ejw) | ejφ(w) | X(ejw) | = √ Re2 {X(ejw)} + Im2 {X(ejw)} φ(w) = arg(X(ejw)) Im(X(ejw)) = tan-1 Re(X(ejw)) + π u (-Re(X(ejw)) )

3

N(ejw) X(ejw) = D(ejw)

then, | N(ejw) | | X(ejw) | = | D(ejw) | If 1 X(ejw) = D(ejw) Then, 1 | X(ejw) | = | D(ejw) |

4 φ(w) = arg (N(ejw)) – arg ( D(ejw)) B. Simple Examples of Forward and Inverse Transforms Example x(n) = δ(n) X(ejw) = ∑ x(n) e-jwn = ∑ δ(n) e-jwn = 1 = X(ejw) Now Find x(n) x(n)=1/2π ∫1•ejwn dw = ejwn/2πjn | = 1 for n = 0 for n≠0 .

e-jw for n = 0 for n ≠ 0. 0 ≤ n ≤ N-1 0 elsewhere. 1-(e-jw )N H(ejw) = ∑ 1 • (e-jw )n = 1. .5 (ejπn – e.jπn) = 2nπj sin(πn) = n = 1 = δ(n) Example Find Transfer function or frequency response for a filter h(n) = 1 .

6 for (e-jw ) ≠ 1 or w ≠ 2πk = N for w = 2πk Find Amplitude and Phase 1-e-jwN H(ejw) = 1-e-jw 1.cos(wN)]2+ sin2(wN) | H(ejw) | = [1.cos(w)]2+ sin2(w) .cos(w) + j sin(w) [1.cos(wN) + j sin(wN) = 1.

cos(wN)) = 2(1.cos(w)) φ(w) = tan-1 sin(wN) 1.(1.(cos(wN) + π u (.7 1+ cos2 + sin2 – 2cos(wN) = 1+ cos2 + sin2 – 2 cos(w) 2(1.(cos(wN) )) sin(w) - tan-1 1-(cos(w) + πu(-(1-(cos(w))) .

starting from : 1-e-jwN H(ejw) = 1-e-jw .8 Find better amplitude and phase response expressions.

.5 cos(w)]2 + [ .5 e-jw )n 1 = 1 .5 cos(w) ) .5n (e-jw )n = ∑ (.5 e-jw 1 = [1 .5n u(n) X(ejw) = ∑ .9 Example Find the DTFT of x(n) = ..5 sin(w)]2 ..5 sin(w) exp -j tan-1 1.

10 Example Find the forward and inverse transforms of x(n) = δ(n) + δ(n-1) X(ejw) = 1 + e-jw x(n) = 1 / 2π ∫ (1+e-jw) ejwn dw = 1 / 2π ∫ ejwn dw + 1 /2π ∫ ejw(n-1) dw ejwn = 2πjn sin(πn) = πn + π(n-1) + ejw(n-1) 2πj(n-1) sin( π(n-1) | = sinc(n) + sinc(n-1) = δ(n) + δ(n-1) .

11 Frequency Response From Difference Equation Shift Theorem: F{x(n–no) } = e-jwn⋅X(ejw) Proof: ∑ x(n–no) e-jwn|n ← n + no = ↑ Given the difference equation. F{∑ ak y(n-k)} = F{∑ bk x(n-k)}. Using the shift theorem. Y(ejw)∑ ak e-jwk = X(ejw)∑ bk e-jwk H(ejw) = Y(ejw)/ X(ejw) . ∑ ak F{y(n-k)} = ∑ bk F{x(n-k)}. ∑ ak y(n-k) = ∑ bk x(n-k) find the frequency response H(ejw) Taking the DTFT of both sides.

with period 2π (2) If x(n) is a real sequence. then Re (X(ejw)) is an even function of w and Im (X(ejw)) is odd Proof: Re {∑ x(n) e-jwn } = ∑x(n)Re{e-jwn} = ∑ x(n) cos(wn) = ∑ x(n) cos(-wn) = Re (X (ej(-w))) = Re (X (ejw)) .12 ∑ bk e-jwk = ∑ ak e-jw Properties of the DTFT (1) X(ejw) is a periodic function of w.

13 Im {X (ejw)} = ∑ Im {x(n)[ cos(wn)-j sin(wn)] } = .∑ Im {x(n)[ cos(wn)+ j sin(wn)] } = .Im X(e-jw ) (3) if x(n) is a real sequence. Proof: Prove it for |X (ej(w))|2 | X (ejw)|2 = X (ejw) • X (ejw)* but X(ejw)* = X (e-jw) so . then |X (ej(w))| is an even function of w and arg {X (ejw)} is an odd function of w.

.14 | X (ejw)|2 = X (ejw) • X (e-jw) | X (e-jw)|2 = X (e-jw) • X (ejw) .tan-1 ∑ x(n)cos(wn) + πu (-∑ x(n) cos(wn) ) -∑x(n)sin(wn) = tan-1 ∑ x(n)(cos(wn) .arg (X (e-jw)) -∑x(n)sin(-wn) = .πu (-∑ x(n) cos(wn) ) = arg (X (ejw)) ∴ arg (X (ejw)) is an odd function.

even sequence.15 (4) let x(n) be a real. Then X (ejw) is real and Im { X (ejw) } = 0. x(n) = x(-n). . Proof: X (ejw) = ∑ x(n) e-jwn = x(0) + ∑ x(n) e-jwn + ∑ x(n) e-jwn | ∑ x(-n) ejwn x(0) + ∑ x(n) (e-jwn + ejwn) = x(0) + 2 ∑ x(n) cos(wn) which is real and even.

ejwn) / 2j = -2j ∑ x(n) sin(wn) which is odd and imaginary (6) F{ x(n-m)} = e-jwm X(ejw) . Then X(ejw) is odd and imaginary. x(n) = -x(-n) x(0) = 0.∑ x(n) ejwn = 2j ∑ x(n) (e-jwn . so Re{X (ejw)} = 0. Proof: X (ejw) = ∑ x(n) e-jwn = ∑ x(n) e-jwn + ∑ x(n) e-jwn ∑ x(n) e-jwn .16 (5) let x(n) be odd and real.

H(ejw) and Y(ejw). the corresponding eigenvalue is H(ejw) y(n) = ∑ h(k) ejw(n-k) = ejwn ∑ h(k)e-jwk = ejwn H(ejw) Note: ∑ x(g(n)) e-jf(w)g(n) = X(ejf(w)) Convolution Theorems for the DTFT (8) If x(n). h(n) and y(n) have DTFT’s X(ejw). y(n) = h(n) x(n).17 (7) x(n) = ejwn is an eigenfunction of the system. then Y(ejw) = H(ejw) X(ejw) . and If y(n) = ∑ h(k) x(n-k).

18 Proof: Take the Fourier Transforms of both sides as Y (ejw) = ∑ ∑ h(k) x(n-k) e-jwn e-jwk e-jw(n-k) = ∑ ∑ h(k) e-jwk x(n-k) e-jw(n-k) = ∑ h(k) e-jwk ∑ x(m) e-jwm = H(ejw) • X(ejw) (9) F{x(n)•h(n)}=1/2π ∫ X(ej(w-u)) H(eju)du First Proof : Let X(ej(w-u)) = ∑ x(n) e-jn(w-u) and H(eju) = ∑ h(m) e-jum on the right .

This gives 1/ 2π ∫ ∑ ∑ x(n) h(m) e-jnw eju(n-m) du = 1/ 2π ∑ ∑ x(n) h(m) e-jnw ∫ eju(n-m) du = ∑ x(n) h(n) e-jnw = F { x(n) ∙ h(n) } Second Proof for Property (9) Let x(n) = 1/ 2π ∫ X(ejv) ejnv dv and h(n) = 1/ 2π ∫ H(eju) ejnu du to get .19 hand side above.

u = w + 2π .v .20 F { x(n) ∙ h(n) } = ∑ x(n) h(n) e-jnw = 1/4π2 ∑ ∫ ∫ X(ejv) H(eju) ejn(u+v-w) du dv =1/4π2∫ ∫ X(ejv) H(eju)[∑ ejn(u+v-w)] du dv 2π ∑ δ(u+v-w-2πn) since ∑ e-jnTw = 2π/ T ∑ δ(w-2πn / T) = 1/2π ∫ ∫ X(ejv) H(eju) [ δ(u + v .w) + δ(u+v-w-2π) du dv u = w-v.

21 = 1/2π ∫ X(ejv) H (ej(w-v)) dv Third Proof for property (9) Let y(n) = h(n) • x(n) . Find Y(ejw) as a function of H(ejw) and X(ejw) h(n) = 1/2π ∫ H(ejθ) ejnθ dθ Y(ejw) = ∑ x(n) h(n) e-jnw = ∑ 1/ 2π ∫ H(ejθ) ejnθ dθ x(n) e-jnw = 1/ 2π ∫ H(ejθ) [ ∑ x(n) e-jn(w-θ)] dθ = 1/ 2π ∫ X(ej(w-θ)) H(ejθ) dθ .

e. Prove that h(n) is shift-orthogonal. i. Let H(ejw) be a causal. 1 h( n) h * ( n + m) = ∑ 2π n =−∞ 1 = 2π π − jw 2 − jwm | H ( e )| e dw ∫ ∫π e − jwm dw = δ (m) . |H(ejw) | = 1 for all w.e. stable allpass filter. n =−∞ ∞ ∑ h( n) h( n + m) = δ ( m) π −π ∞ From (10).22 (10) Parseval’s Equation 1 h ( n ) x *( n ) = ∑ 2π n =−∞ 1 x *(n) = 2π 1 h n ( ) ∑ 2π n =−∞ 1 2π π − ∞ ∞ π −π jw ∫ H (e jw ) X *(e jw )dw )e − jwn dw − jwn π − ∫π X *(e ∫ so LHS = π π X *(e )e jw −π jw 1 dw = 2π −π ∫ X *(e ) ∑ h(n)e − jwn dw jw n =−∞ ∞ ∫π X *(e ) H (e jw )dw = RHS Ex. i.

Zero Phase averaging filter. FIR. nonrecursive 1 y(n) = (1+2M) if |k| ≤ M ∑ x(n-k) 1 h(k) = (1+2M) 1 H(ejw) = (1+2M) ∑ e-jnw .23 Example IIR and FIR filters Ex.

e-jw(M+1) ) = (1-e-jw ) (ej(M+1/2)w-e-jw(M+1/2)) = (ejw/2-e-jw/2 ) 1 (1+2M) 1 (1+2M) 1 = (1+2M) sin((M+1/2)w) sin(w/2) Example Find G(ejw) if g(n) = x(2n) g(n) = 1/ 2π ∫ X(ejθ) ej(2n)θ dθ .24 (ejMw.

u1 = w +2π = lower limit u2 = w . du = -2dθ dθ = -1/2 du. u= w.2θ.2π = upper limit Switch limits and change signs.25 G(eiw) = ∑ g(n) e-jnw = ∑ 1/ 2π ∫ X(ejθ) ej2nθ dθ e-jnw = 1/ 2π ∫ X(ejθ) [ ∑ e-jn(w-2θ)] dθ Change of variable to simplify the exponent. G(eiw) = 1/ 4π ∫ X(ej(w-u)/2) [ ∑ e-jnu] du But .

26 2π ∑ e-jnTw = T so ∑ δ(w-2πn / T) ∑ e-jnu = 2π ∑ δ(u .ej(w/2)) ] = G(ejw) .2πn) G(ejw) = ½ ∑ ∫ X(ej(w-u)/2) δ(u-2πn) du = 1/2 [ X(ejw/2) + X (ej(w/2-π)) ] = 1/2 [ X(ejw/2) + X ( .

Frequency response is (1-be-jw) H(ejw) = (1-ae-jw) | (1.be-jw) |2 | H(ejw) |2 = | (1. find b such that the system is allpass. More Examples Example y(n) .a y(n-1) = x(n) – b x(n-1) y(n) = x(n) – b x(n-1) + a y(n-1) Given a.2b cos(w)) = (1+a2 .2a cos(w)) .ae-jw) |2 (1+b2 .27 E.

28 (1+ (1/b2) – 2 (1/b) cos(w) ) = b2 (1+ a2 .2a cos(w)) (1+ a2 – 2 a cos(w)) Example Let X(ejw) = F{ x(n)} Find the sequence y(n) in terms of x(n) if Y(ejw) = X2(ejw) .2a cos(w)) try b = 1/a 1 = a2 (1+ a2 .

and sum over m disappears. ∴ y(k) = ∑ x(n) x(k-n) .29 X2(ejw) = (∑ x(n) e-jnw) ( ∑ x(m) e-jmw ) = ∑ y(k) e-jkw note difference indexes ∴ ∑ ∑ x(n) x(m) e-jw(n+m) = ∑ y(k) e-jkw e-jw(n+m) = e-jkw solve for n as n+m = k m = k-n m is fixed now.

Example g(n) = x(n / 2).30 y(n) = ∑ x(k) x(n-k) Alternately. g(n) = x(n/2) = 1/ 2π ∫ X(ejθ) ej(n/2)θ dθ . Find G(ejw) = ∑ g(n) e-jnw = ∑ x(n/2) e-jnw = ∑ x(n) e-jn(2w) so X (ej2w) = G(ejw) Hard Method g(n) = Same Definition. n odd. use convolution theorem. n even 0 .

.given constant w.2w .2πn) dθ ∑ δ(w .2πn) use 2π ∑ e-jnTw = T = ∑ ∫ X(ejθ) δ(θ .31 G(eiw) = ∑ 1/ 2π ∫ X(ejθ) ej(n/2)θ dθ e-jnw = 1/ 2π ∫ X(ejθ) [ ∑ e-j(n/2)(θ-2w)] dθ ∑ e-jn(θ-2w) = 2π ∑ δ(θ .2πn).2πn / T) Question. how many values of n will generate a non-zero δ(θ .2w .2w .

only one. use n = 0. Ideal LP Filter ejwn h(n) = (1 / 2π) ∫ ejwn dw = ej(wc)n – e-j(wc)n = (2j) πn | 2πjn .2w) dθ = X(ej2w) Ex.2w) and θ = 2w so = ∫ X(ejθ) δ(θ .32 Answer. ∴ use δ(θ .

33 sin(wcn) = πn Ex.sin(wc1n) h(n) = πn . Ideal BP Filter sin(wc2n) .

34 How do we implement y(n) = h(n) * x(n) in pseudocode if sin(wc2n) .sin(wc1n) h(n) = πn .

The problems here are that: . the number of real multiplies is NM = 2(n+1). Using past samples up to time n.35 F. and continuing up to time n. Advanced Topic Number 1 Problems: Applications. we can calculate a Sliding DTFT of the data in several ways. such as speech recognition and communications have a continuous stream of samples coming in. and spectral information is needed. Solution 1 With samples starting at time 0. we get Xn (e ) = jw -jwm x(m)e ∑ m=0 n If x(n) is real.

However. (2) The time variable n causes overflow. starting at time n-(N-1). Although the limits on the sum increase. leading to overflow. this could be fixed by using a shift register that keeps only the most recent N samples. and n increases as new data comes in. the exponent of e still grows without bound.36 (1) NM quickly becomes too large to update in real time. . Solution 2 We can solve the first problem by defining a spectrum over a fixed window of N samples. as Xn (e )= jw ∑ m=n-(N-1) n x(m)e-jwm NM is 2N with N fixed.

and we have NM = 6 real multiplies. since Xn-1 (e )= e jw jw(n-1) ∑ m=n-(N-1)-1 x(m)e-jwm we can write Xn (e jw )= e jw Xn-1 (e jw ) + x(n)-x(n-N)e jwN Now the exponents are well-behaved. .37 Solution 3 We can solve the exponent problem by redefining the spectrum as Xn (e ) = jw ∑ m=n-(N-1) n jwn n x(m)e-jw(m-n) which can be re-written as Xn (e )= e jw ∑ m=n-(N-1) x(m)e-jwm n−1 Now.

the kth complex feature X(k). is calculated and updated as X(k) = Xn(ejw(k)) on the previous page. Here wo(n) denotes a frequency that is slowly changing with time. where x(n) = cos(wo(n)⋅n + φ(n)) + n(n) and where n(n) represents noise.38 Ex: Suppose that a signal x(n) is being monitored. define evenly spaced frequencies as w(k) = (π/(NF-1))(k-1) . . (a) For k between 1 and NF . in the feature vector X. (a) Indicate a method for calculating and updating a relevant feature vector. Solution: Given the number of features NF. over a moving window of N time samples (b) Give a method for estimating wo(n).

estimate wo as: Xmax = |X(1) |. wo = w(1) For 2 ≤ k ≤ NF If( |X(k) | > Xmax)Then Xmax = |X(k) | wo = w(k) Endif End .39 (b) At each time n.