DSP & Digital Filters

Download Report

Transcript DSP & Digital Filters

Discrete Fourier
Transforms
• Consider finite duration signal
x(n)
• Its z-tranform is
n  0...N  1
N 1
X ( z )   x(n).z n
n 0
• Evaluate at points on z-plane as
N 1
X ( k )  X ( z ) z   x ( n )e
k
j
2
kn
N
n 0
• We can evaluate N independent points
1
Professor A G Constantinides
Discrete Fourier
Transforms
N 1
X ( k )   x ( n )e
j
2
kn
N
n 0
• This is known as the Discrete Fourier
Transform (DFT) of x(n)
• Periodic in k ie X (k  pN )  X (k )
• This is as expected since the spectrum is
periodic in frequency
2
Professor A G Constantinides
Discrete Fourier
Transforms
• Multiply both sides of the DFT by e
• And add over the frequency index k
N 1
 X ( k )e
k 0
• From which
3
j
2
km
N
N 1
N 1 j
n 0
k 0
  x ( n)  e
N 1
j
2
km
N
2
k ( mn )
N
1
x(n)   X (k ).e
N k 0
j
2
kn
N
Professor A G Constantinides
Discrete Fourier
Transforms
• This is the inverse DFT
N 1
1
x(n)   X (k ).e
N k 0
j
2
kn
N
x(n  qN )  x(n)
• That is a) the DFT assumes that we deal
with periodic signals in the time domain
b) Sampling in one domain
produces periodic behaviour in the other
domain
4
Professor A G Constantinides
Discrete Fourier
Transforms
• Effectively by knowing X ( z ) z  zk  X (k )
• X (z ) is known everywhere since
N 1
N 1 1 N 1
n 0
n 0 N k 0
X ( z )   x(n).z n  
• or
5
 X ( k )e
j
2
kn
N z n
1 N 1
1  zN
X ( z )   X (k ).
2
N k 0
j k
1  e N .z 1
Professor A G Constantinides
Discrete Fourier
Transforms
• The formula
1 N 1
1  zN
X ( z )   X (k ).
2
N k 0
j k
1
N
1 e
.z
• This is essentially an interpolation and
forms the basis of the Frequency Sampling
Method for FIR digital filter design
6
Professor A G Constantinides
Convolution in DFT
• Consider the following transform pairs
x p (n)  X p (k ) hp (n)  H p (k )
• Define Y (k )  H (k ). X (k )
p
p
p
• Find

y p (n)  IDFT[Yp (k )]
7
Professor A G Constantinides
Convolution in DFT
• From IDFT
N 1
1
y p (n)   Y p (k ).e
N k 0
• However
j
2
kn
N
N 1
1
  H p (k ). X p (k ).e
N k 0
N 1
H p ( k )   h p ( m)e
j
j
2
kn
N
2
km
N
m 0
N 1 N 1
8
1
y p (n)    h p (m).e
N k 0 m 0
j
2
km
N
.X
p ( k ).e
j
2
kn
N
Professor A G Constantinides
Convolution in DFT
• Or
N 1
N 1
2
k ( nm)
N
1
y p (n)   h p (m).  X p (k ).e
N
m 0
k 0

j
x p ( nm)
• Thus
N 1
y p (n)   hp (m).x p (n  m)
m 0
• This the Circular Convolution
9
Professor A G Constantinides
Computation of the DFT: The
FFT Algorithm
• Computation of DFT requires for every
sample N multiplications. There are N
samples to be computed i.e. N 2 time
consuming operations.
• The Fast Fourier Algorithm:(Decimation in
time - DIT, assume even no. of samples)
• set x1 (n)  x(2n) x2 (n)  x(2n  1)
10
N
n  0,1,...,  1
2
Professor A G Constantinides
FFT
• Then DFT of {x(n)} is written
N 1
X (k )   x(n).WN
nk
n 0
• set
WN  e
11
2
N
  x(n).WN
nk
n 0
even
j
N 1
odd
WN  e
2
 j 2
( N 2)
 WN
2
Professor A G Constantinides
FFT
• ie
N
1
2
X (k )   x1 (n).WN
n 0
nk
2
N
1
2
k
 WN  x2 (n).WN
n 0
k
• Or
X (k )  X1 (k )  WN X 2 (k )
• Computations of each of summations is
2
now of order (N / 2) ,and thus total
computational effort is reduced to N 2 / 2.
• Continuation of “divide-&-compute”
reduces effort to Nlog(N)
12
Professor A G Constantinides
nk
2
8-point FFT
• 8-point Signal Flow Diagram
x(0)
x(4)
X(0)
X(1)
X(2)
X(3)
X(4)
X(5)
X(6)
X(7)
x(2)
x(6)
x(1)
x(5)
x(3)
x(7)
a
13
b
Professor A G Constantinides
FFT times
• Time (1 multiplication per microsec)
26
29
212
215
218
14
N
64
512
4096
32768
262144
Direct DFT
FFT
.02 sec
.002 sec
1
.02 sec
67
.2
1 hr 11 mins 2
3 days 4 hrs 19
Professor A G Constantinides
Decimation-in-Time FFT
Algorithm
• In the basic module two output variables are
generated by a weighted combination of
two input variables as indicated below
where r  1,2,,  and ,   0,1,, N  1
• Basic computational module is called a
butterfly computation
15
Professor A G Constantinides
Decimation-in-Time FFT
Algorithm
• Input-output relations of the basic module
are:
r 1[ ]  r [ ]  WN r [  ]
•
  ( N / 2)
r 1[  ]  r [ ]  WN
r [  ]
Substituting WN ( N / 2)  WN in the second
equation given above we get

r 1[  ]  r [ ]  WN r [  ]
16
Professor A G Constantinides
Decimation-in-Time FFT
Algorithm
• Modified butterfly computation requires
only one complex multiplication as
indicated below
• Use of the above modified butterfly
computation module reduces the total
number
of
complex
multiplications
by
50%
17
Professor A G Constantinides
Decimation-in-Time FFT
Algorithm
• New flow-graph using the modified
butterfly computational module for N = 8
18
Professor A G Constantinides
Decimation-in-Time FFT
Algorithm
• Computational complexity can be reduced
further by avoiding multiplications by WN0  1,
WNN / 2  1 , WNN / 4  j , and WN3 N / 4   j
• The DFT computation algorithm described
here also is efficient with regard to memory
requirements
• Note: Each stage employs the same butterfly
computation to compute r 1[ ] and r 1[  ]
from r [ ] and r [  ]
19
Professor A G Constantinides