Discrete Time Fourier Transform (DTFT) & Discrete Fourier Transform (DFT)

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 47

Discrete Time Fourier

Transform (DTFT) & Discrete


Fourier Transform(DFT)

1
The Fourier Transform of Discrete-Time Aperiodic
Signals or Discrete Time Fourier Transform
(DTFT)
The Fourier Transform of a finite energy discrete
time signal x[n] is defined as

X( w )   x[n]e
n  
 jwn

X(w) may be regarded as a decomposition of x[n]


into its Frequency components. It is not difficult to
Verify that X(w) is periodic with period 2.
The Inverse Fourier Transform of X(w) may be
defined as
1
x[n]  
jwn
X( w )e dw
2 2 

Combine these equations are called DTFT pair. 2


Energy Density Spectrum of Aperiodic
Signals
Energy of a discrete time signal x[n] is defined as
 2

Ex   x[n]
n  

Let us now express the energy Ex in terms of the


spectral characteristic X(w). First we have
 
1   
E x   x[n]x [n]   x[n]  X ( w )e  jwn dw 
*

n   n    2   

If we interchange the order of integration and


summation in the above equation, we obtain
1      jwn  1  2
Ex   X ( w )  x[n]e dw   X( w ) dw
2  
n    2  

3
Therefore, the energy relation between x[n] and
X(w) is
2  2

1
E x   x[n]   X( w ) dw
n   2  

 This is Parseval’s relation for discrete-time


aperiodic signals.

Or simply

Is called Energy Density Spectrum and represents


Distribution of energy as a function of frequency.
The Energy Spectral Density (ESD) of a given signal is the
square of its Fourier transform.
4
Example: Determine and sketch the energy
density spectrum of the signal x[n] = anu[n],
-1<a<1
 
  
Solution: X( w )   x[n]e  jwn
 a e n  jwn
  ae  jw 
n 1
n   n0 n0 1  ae  jw
The energy density spectrum (ESD) is given by
2 1
S xx ( w)  X ( w)  X ( w) X  ( w) 
1  ae 1  ae 
 jw jw

1
X(w) 
1  2a cos w  a 2

a = 0.5 a= -0.5

w
5
 0 
Example: Determine the Fourier
Transform and the energy density
spectrum of the sequence  A,
x[n ]  
 0,
0  n  L 1
otherwise

Solution:
 L 1
1  e  jwL  j( w / 2 )( L 1 ) sin( wL / 2)
X( w )   x[n
n  
]e  jwn
  Ae  jwn

0
A
1e  jw
 Ae
sin( w / 2)

The magnitude of x[n] is



 A L, w0
X( w )  
 A sin( wL / 2 )
, otherwise
 sin( w / 2)

The signal x[n] and its magnitude is plotted on the next slide.

6
x[n]

|X(w)|

 The ESD (Energy Spectral Density of x[n] is given by:


ESD =
7
DTFT Theorems and Properties
 Fourier Transform for aperiodic energy signals
possesses a number of properties that are very
useful in reducing the complexity of frequency
analysis problems.

Linearity
If x1[n]  X1(w) and x2[n]  X2(w), then
a1x1[n] + a2x2[n]  a1X1(w) + a2X2(w)

8
Example 1: Determine the DTFT of the signal
x[n] = a|n|
Solution: First, we observe that x[n] can be
expressed as
x[n] = x1[n] + x2[n]
where

a n , n  0 a  n , n  0
x1 [n]   and x 2 [n]  
 0, n  0  0, n  0

9
 
  

 x1[n]e  a e   ae  jw
 jwn n  jwn n
Now X1 ( w ) 
n   n 0 n 0

  
2
 1  ae  jw  ae  jw  ae  jw  ....   3 1
1  ae  jw

 ae 
 1 1

and X2  w    x 2[n]e  jwn


 a e  n  jwn
 jw  n

n   n   n  

   ae 
 jw
jw k ae
 ae jw  ( ae jw ) 2  ... 
k 1 1  ae jw
Now
1 ae jw 1  a2
X( w )  X1 ( w )  X 2 ( w )   jw
 
1  ae 1  ae jw
1  2a cos w  a 2
10
 Time Shifting
If x[n]  X(w) then x[n-k] = e-jwkX(w)

Proof: F x[n  k ]  x[n  k ]e  jwn
 n  

Let n – k = m or n = m+k
 
 F x[n  k ]   x[m]e  jw ( m  k )
e  jwk
 x[m ]e  jwm
 e  jwk
X( w )
m   m  

 Time Reversal property


If x[n]  X(w) then x[-n]  X(-w)
Proof:
  
F x[n]   x[n]e  jwn
  x[m]e jwm
  x[m]e  j(  wm )
 X( w )
n   m  m  
11
 Convolution Theorem
If x1[n]  X1(w) and x2[n]  X2(w)
then
x[n] = x1[n]*x2[n]  X(w) = X1(w)X2(w)
Proof: As we know

x[n]  x1 [n] * x 2 [n]   x [k ]x [n  k ]
k  
1 2

 
    jwn
Therefore X( w )   x[n]e
n  
 jwn
    x1[k ]x 2 [n  k ]e
n    k   
Interchanging the order of summation and making
a substitution n-k = m, we get

  
X( w )   x1 [k ]  x 2 [m ]e  jw ( m  k )
k    m   
   jwk  

 jwm 
   x1 [k ]e   2 x [m ]e   X1 ( w ) X 2 ( w ) 12
 k     m   
 Example 2: Determine the convolution of
the sequences x1[n] = x2[n] = [1, 1, 1]
 1

Solution:
X1 ( w )  X 2 ( w )   x1[n]e
n  
 jwn
  1
x [n
n  1
]e  jwn

  x1[ 1]e jw  x1[0]  x2 [1]e  jw   [e jw  1  e  jw ]


 1  2 cos w
 Then
X(w) = X1(w)X2(w) = (1 + 2cosw)2
= 3 + 4cosw + 2cos2w
= 3 + 2(ejw + e-jw) + (ej2w + e-j2w)
Hence the convolution of x1[n] and x2[n] is
x[n] = [1 2 3 2 1]
]
13
 Tutorial 6 Q1: Find the convolution of the signals
of Example 2
(a) from first principle (b) by using the z-transform.

 Correlation Theorem:
If x1[n]  X1(w) and x2[n]  X2(w)
Then rx1x2  Sx1x2 = X1(w)X2(-w)
where Sx1x2 is called the cross-energy density
spectrum.

 Tutorial 6 Q2: Prove the Correlation


Theorem.

Cross-energy= two different signals x1 n x2.


 The Wiener-Khintchin Theorem:
Let x[n] be a real signal. Then rxx[k] Sxx(w)
In other words, the DTFT of autocorrelation function is
equal to its energy density function. It means that auto
correlation and ESD of a signal contain same information
about signal.
Proof: The autocorrelation of x[n] is defined as

rxx[n]   x[k ]x[k  n]
k  

Now

    jwn
F[rxx[n]]  
n  

 k  
x[k ]x[k  n ]e

Re-arranging the order of summations and making
Substitution m = k+n we get
15

    jw ( m k )
F[rxx[n]]   x[k ]  x[m] e
k   m   

    
 jwm 
   x[k ]e    x[m]e   X ( w) X ( w) | X ( w) |2  S xx  w
jwk

k   m 
 Frequency Shifting:
If
x[n]  X( w )
then
e jw 0n x[n]  X( w  w 0 )

Tutorial 6 Q3: Prove the Frequency shifting


Property.
16
 The Modulation Theorem:
If x[n]  X(w) then
x[n]cosw0[n]  ½X(w + w0) + ½X(w-w0)
Proof:
 
 e jw 0n  e  jw 0n   jwn
F x[n] cos w 0n   x[n ] cos w 0 ne  jwn
  x[n] e
n   n    2 
1 

  x[n] e  j ( w w0 ) n  e  j ( w w0 ) n
2 n  

1  1 
1 1
  x[n]e  j ( w w0 ) n   x[n]e  j ( w w0 ) n  X  w  w0   X  w  w0 
2 n 2 n  2 2

17
 Parseval’s Theorem:
If x1[n]  X1(w) and x2[n]  X2(w) then
 
1

n  
x 1 [n ]x *
2 [n ]  
2  
X 1 ( w ) X *
2 ( w )dw

 
1 1   
Proof: R .H.S.   X1  w X 2  w  dw     x1  ne  jwn X*2 ( w )dw
*

2   2   n   
  
1
  x1 [n]  X *
2 ( w )e  jwn
dw   x 1 [n ]x 2 [n ]  L .H .S
*

n   2   n  

In the special case where x1[n] = x2[n] = x[n], the


Parseval’s Theorem reduces to 2
 2 
1

n  
x(n ) 
2  X( w ) dw


We observe that the LHS of the above equation is energy Ex


of the Signal and the R.H.S is equal to the energy 18
density spectrum.
Thus we can re-write the above equation as
 2  
1 1
E x   x[n]   
2
X( w ) dw  S xx ( w )dw
n   2   2  

• Multiplication of two sequences:


If x1[n]  X1(w) and x2[n]  X2(w) then

1
x1 [n]x 2 [n]   X 1    X 2  w    d
2  

Proof:   1  
F x1[n]x 2 [n]   x [n]x [n]e
1 2
 jwn
   X 1   e j n
d  x 2 [n ]e  jwn

n   n    2   
 
1    j( w   ) n  1
  X1   d   x 2 [n]e    X1   X 2 ( w   )d
2    n    2  
19
 Differentiation in the Frequency Domain:
If x[n]  X(w) then nx[n]  jdX(w)/dw
Proof: dX( w ) d    jwn 

d  jwn
dw
  
dw n  
x[n]e    x[n] e
 n   dw

dX( w )
   j  nx[n]e  jwn
dw n  

Multiplying both sides by j we have



dX( w )
j   nx[n]e  jwn
dw n  

or dX ( w)
j  F [nx[n]]
dw
20
The Frequency Response Function:
The response of any LTI system to an arbitrary input
signal x[n] is given by

y[n]   h[k ]x[n  k ]
k  
(1)

In this I/O relationship, the system is characterized


in the time domain by its unit impulse response
h[k]. To develop a frequency domain
characterization of the system, let us excite the
system with the complex exponential
x[n] = Aejwn. - < n <  (2)
where A is the amplitude and w is an arbitrary frequency
confined to the frequency interval [-, ]. By substituting
(2) into (1), we obtain the response 21
 h[k ] Ae 

jw ( n  k )
y[n] 
k  

  
 A   h[k ]e  jwk  e jwn
 k   

or y[n]  AH( w )e jwn (3)



Where H( w )   h[k ]e
k  
 jwk
(4)

Is Fourier Transform of the impulse response h[k].

We observe that the system response is also in the form of


complex exponential with the same frequency as the input
but altered by the multiplicative factor H(w).

22
As a result of this characteristics behavior, the exponential
signal Aejwn is called an eigenfunction of the system. An
eigenfunction of a system is an input signal that produces an
output that differs from the input by a constant
multiplicative factor. The multiplicative factor is called an
eigenvalue of the system.

In this case Aejwn is eigenfunction of the system and H(w)


evaluated at input frequency is eigenvalue of the system.

23
Example: Determine the magnitude and phase of H(w)
for the three point moving average (MA) system
y[n] = 1/3[x[n+1] + x[n] + x[n-1]]
Solution: since h[n] = [1/3, 1/3, 1/3]

It follows that
H(w) = 1/3(ejw +1 + e-jw) = 1/3(1 + 2cosw)
Hence
|H(w)| = 1/3|1+2cosw| and

( w)  tan 1 (0)  0

The moving average filter is a simple Low Pass FIR (Finite Impulse Response) filter
commonly used for smoothing an array of sampled data/signal. It takes M samples of input at a
time and take the average of those M-samples and produces a single output point. 24
Example:An LTI system is described by the
following difference equation:
y[n] = ay[n-1] + bx[n], 0<a<1
(a) Determine the magnitude and phase of
the frequency response H(w) of the system.
(b) Choose the parameter b so that the
maximum value of |H(w)| is unity.
(c) Determine the output of the system to
the input signal
x[n] = 5 + 12sin(/2)n – 20cos (n + /4)

25
Solution:
(a) The frequency response is
 jw
Y( w )  ae Y( w )  bX( w )
 jw
(1  ae )Y( w )  bX( w )
Y ( w) b b b
H ( w)    
X ( w) 1  ae  jw
1  a(cos w  j sin w) 1  a cos w  ja sin w
Now
b b
H ( w)  
1  a cos w   a sin w
2 2
1  a 2  2a cos w

and  a sin w 
1
 ( w )   tan  
 1  a cos w 

26
(b) It is easy to find that |H(w)| attains its
maximum value at w = 0. At this frequency,
we have
b
H ( 0)   1 Which implies that b = ±(1-a).
1a

At b = (1-a), we have
1a a sin w
H( w )  1
1  a 2  2a cos w and  ( w )   tan 1  a cos w

(c) The input signal consists of components of frequencies


w = 0, /2 and  radians.
For w = 0, |H(0)| = 1 and (0) = 0.
For w = /2,    1  a 1  0.9
H     0.074.
 2 1 a 2
1  (0.9) 2


    tan 1 a   tan 1 ( 0.9)  420 27
2
For w = , 1a
| H( w ) |  0.053
1 a
(  )  0

Therefore, the output of the system is

         
y[n]  5 H(0)  12 H  sin  n     20 H( ) cos  n      
 2 2  2   4 
 5  0.888 sin( n  42 )  1.06 cos( n  )

2
0 
4

28
Example_1:
HOMEWORK PROBLEMS Determine the output sequence of the system with
impulse response h(n) = (1/2)nu(n), when the input
signal is complex exponential sequence x(n) =10ejnπ/2 .

Example_2:
Determine the output sequence of the system with
impulse response h(n) = (1/2)nu(n), when the input
signal is complex exponential sequence x(n) = 5ejnπ .

Example_3:
Determine the response of the system to the input
signal x(n) = 10 - 5sin(nπ/2) + 20cos(nπ), when the
system impulse response is h(n) = (1/4)nu(n).
HOMEWORK PROBLEMS   Example_4:
An FIR filter is described by the following difference
equation
y(n) = x(n) + x(n-10)

i- Compute magnitude and phase response of H(w).


ii- Determine system response to the input

30
Response to aperiodic input signals
Consider the LTI system of the following figure
where x[n] is the input, and y[n] is the output.
x[n] y[n]
LTI System
h[n], H(w)

If h[n] is the impulse response of the system, then


y[n] = h[n]*x[n]
The corresponding frequency domain representation is
Y(w) = H(w)X(w)
Now the squared magnitude of both sides is given by
|Y(w)|2 = |H(w)|2|X(w)|2
Or
Syy(w) = |H(w)|2Sxx(w)
where Sxx(w) and Syy(w) are the energy density spectra of the
input and output signals, respectively. 31
The energy of the output signal is
 
1 1
Ey    
2
S yy ( w )dw | H ( w ) | S xx ( w )dw
2   2  

Example: An LTI system is characterized by its


impulse response h[n] = (1/2)nu[n]. Determine the
spectrum and the energy density spectrum of
the output signal when the system is excited by the
signal x[n] = (1/4)nu[n].
Solution:  n
1
H( w )    12  e  jwn 
n0 1  12 e  jw
1
Similarly, X( w ) 
1  14 e  jw

Hence the spectrum of the signal at the output of the system


is 32
1
Y( w )  H( w ) X( w ) 
 
1  12 e  jw 1  14 e  jw 
The corresponding energy density spectrum is
2 2 2
S yy ( w )  Y( w )  H( w ) X( w )
1

 54  cos w  1716  12 cos w 

33
DTFT and DFT
As the name implies, the Discrete Fourier
Transform (DFT) is purely discrete: discrete-time data
sets are converted into a discrete-frequency
representation.

This is in contrast to the DTFT that uses discrete time


data, but converts to continuous frequency.

Since the resulting frequency information in DFT is


discrete in nature, it is very common for computers to
use DFT(Discrete fourier Transform) calculations when
frequency information is needed.
34
DTFT and DFT
 The DTFT of an aperiodic discrete time
signal is defined as

X ( w)   x[n]e (1)  jwn

n  

 The DFT of a signal is defined as


N 1
X(k )   x[n]e  jk 2 n / N (2)
n 0

 Inverse DFT is defined as


N 1
1
x[n] 
N
 X
k 0
[ k ]e j 2kn / N
(3)

Here, k is used to denote the frequency domain index, and n


is used to represent the time-domain index. The big "N" is the
length of the sequence to be transformed.
The Discrete Fourier Transform is a numerical variant of the
Fourier Transform. Specifically, given a vector of n input
amplitudes such as {a0, a1, a2, ... , an-2, an-1}, the Discrete Fourier
Transform yields a set of n frequency magnitudes.
 The DFT is periodic with period N.
N 1
Proof: X[k ]   x[n ]e  jk 2 n / N

n0
N 1
X[k  N ]   x
n0
[n ]e  j( k  N ) 2 n / N

N 1
  x[n]e
n0
 jk 2 n / N
e  j 2 n

Since e-j2n = 1
N 1
 X[k  N ]   x[n]e
n0
 jk 2 n / N

 X[k ]
36
proved
Relation to DTFT
 The DFT and the DTFT are related to each
other in a very simple manner.

 If we take the DTFT of a given time


sequence, x[n], we will get a continuous-
frequency function called X(w).
 If we sample X(w) at N equally-spaced
locations, the result will be the DFT, X[k].
 DFT deals with representing x(n) with
samples of its spectrum X(ω).
Example 1: Find the DFT of the following sequence
[1 0 0 1]
Solution:
N 1 3 3
X[k ]   x[n]e  jk 2 n / N   x[n]e  jk 2 n / 4   x[n]e  jkn / 2
n0 n0 n 0

Now
3
X[0]   x[n]  x[0]  x[1]  x[ 2]  x[ 3]  1  0  0  1  2
i 0
3
X[1]   x[n]e  jkn / 2  x[0]  0  0  x[ 3]e  j3  / 2
n0
 j3  / 2
 1  1.e  1  cos( )  j sin( )  1  j
3
2
3
2
3
X[2]   x[n]e  jn  x[0]  x[3]e  j3 n  1  1.[cos( 3n )  j sin  3n  ]  0
n0

X [3]  1  j 38
Example 2: Find the IDFT of the sequence
[2 1+i 0 1-i]
Solution: x[n]   X[k ]e jk 2 n / N
1 N 1

N k 0
1 N 1 1
Now x[0]   X [k ]   X [0]  X [1]  X [2]  X [3]  1
4 k 0 4
1 3 1 3
x[1]   X[k ]e jk 2  / 4
  X[k ]e jk / 2
4 k 0 4 k 0
j / 2 j j3  / 2
 X[0]  X[1]e  X[2]e  X[3]e 0
Similarly,

X[2] = 0 and X[3] = 1


39
HOMEWORK PROBLEMS  Example_1: Compute DFT of the four point
sequence x[n] = {0, 1, 2, 3}.
 Ans: X(k) = {6, -2+2j, -2, -2-2j}

 Example_2: Find DFT magnitude and phase


for samples of the signal given as:
x[n] = {5, 2, -2, 4}
and verify that inverse DFT produces the
same samples.
Ans: X(k) = {9, 7+2j, -3, 7-2j}.
x[n] = {5, 2, -2, 4}
40
Use of the DFT in linear filtering
Suppose we have a finite duration sequence x[n]
of length L which excites an FIR filter of length
M. The impulse response of the filter is h[n].
The output sequence y[n] of the FIR filter may be
expressed in the time domain as
M 1
y[n ]   h[k ]x[n  k ]
k 0
(4)

Since h[n] and x[n] are finite duration sequences,


their convolution is also finite in duration. In fact
the duration of y[n] is L+M-1.
The frequency equivalent of (4) is
Y(w) = X(w)H(w)
41
If the sequence y[n] is to be represented uniquely in the
frequency domain by samples of its spectrum Y(w) at a
set of discrete frequencies, the number of discrete
Samples must equal or exceed L+M-1. Therefore, a DFT
of size N  L + M – 1 is required to represent {y[n]} in
the frequency domain. Now if
Y[k] = Y[w]| w = 2k/N, k = 0,1,…,N-1
= X(w)H(w)|w = 2k/N, k = 0,1,…,N-1
Then
Y[k] = X[k]H[k] k = 0,1,…,N-1

Example3: By means of DFT, and IDFT, determine


The response of the FIR filter with impulse response
h[n] = [1 2 3] to the input sequence x[n] = [1 2 2 1].
42
Solution: The input sequence has length L = 4 and the
impulse response has length M = 3. Linear convolution
Of these two sequences produces a sequence of length
N = 6. Consequently, the size of the DFTs must be at
least six. For simplicity, we compute eight point DFTs.
7
X[k ]   x[n]e  j 2 kn / 8

n0

This computation yields


X(0) = 6, X(1)  2 2
2
j  4 3 2
2

X(2) = -1 - j X( 3)  2 2
2
 j 4 3 2
2

X(4) = 0 X(5)  2 2
 j 4 32 2
 
2
X(6) = -1 + j
X(7 )  2 2
2
 j 4 32 2 43
The 8-point DFT of h[n] is
7
H[k ]   h[n]e  j2 kn / 8
n0

H[0] = 6 H[1] = 1 + 2 – j(3 + 2), H[2] = -2 – j2


H[3] = 1 - 2 + j(3 - 2) H[4] = 2
H[5] = 1 - 2 – j(3 - 2), H[6] = -2 + j2
H[7] = 1 + 2 + j(3 + 2)
Now Y[k] = X[k]H[k] = [36 –14.07-j17.48 j4
0.07 + j0.515 0 0.07 – j0.515 -j4 -14.07 + j17.48
Finally, the 8-point IDFT is
7
y[n]  1
8  Y
k 0
( k )e j 2 kn / 8

The computation yields the result, y[n] = [1 4 9 11 844 3


0 0]
Computational Complexity of the DFT
 A large number of multiplications and additions
are required for the calculation of the DFT. For an
8-point DFT, the expansion for X(k) becomes
7
X[k ]  x[n]e kj2=nk
 0,1,2,…,7
/N

n0

and letting k2\8 = K this expands to


X[k ]  x[0]e  jK 0  x[1]e  jK 1  x[ 2]e  jK 2  x[ 3]e  jK 3 
x[4]e  jK 4  x[5]e  jK 5  x[6]e  jK 6  x[7]e  jK 7

There are 8 complex multiplications and 7


complex additions. There are 8 harmonic
components (k = 0,1,2,…, 7) to be evaluated.
45
Therefore, for an 8-point DFT:
Number of complex multiplications = 88
Number of complex additions = 87

Similarly, for an N-point DFT:


Number of complex multiplications = NN
Number of complex additions = N(N-1)
If N = 1024, then approximately one million
complex multiplications and one million complex
additions are required. Clearly some means of
reducing these numbers is desirable. For this a
number of algorithms have been developed.
Usually each of such algorithm is called the Fast
Fourier Transform (FFT).
46
Using a series of mathematical tricks and generalizations,
there is an algorithm for computing the DFT that is very fast
on modern computers. This algorithm is known as the Fast
Fourier Transform (FFT), and produces the same results as
the normal DFT, in a fraction of the computational time as
ordinary DFT calculations.

47

You might also like