Académique Documents
Professionnel Documents
Culture Documents
Dan Ellis
2013-11-27
Filter design so far has been oriented to time-domain processing - cheaper! But: frequency-domain processing makes some problems very simple:
DFT
!
x[n]
X[k]
y[n]
Dan Ellis
The DFT
!
N !1
( WN = e
!j
2" N
WN@2/N WNr has only N distinct values Structure opportunities for efficiency
!
X [N 1] X [0] X [1] X [2] . . .
1 1 1 = . . . 1
Matrix form:
1 2 WN 4 WN . . .
2(N 1) WN
.. .
(N 1) WN 2(N 1) WN . . . (N 1)2 WN
x[N 1]
Dan Ellis
2013-11-27
Computational Complexity
X[k ] = "
!
N !1 n =0
kn x[n]WN
N complex multiplies + N-1 complex adds per point (k) ! N points (k = 0.. N-1)
!
cpx mult: (a+jb)(c+jd) = ac - bd + j(ad + bc) = 4 real mults + 2 real adds cpx add = 2 real adds
Dan Ellis
"! x[!]
! k ( N ! !) WN
Goertzels Algorithm
!
! !
No large buffer, no coefficient table Same complexity for full X[k] (4N2 mults, 4N2 - 2N adds)
!
H (z)
but: can halve multiplies by making the denominator real: evaluate only
Dan Ellis
Works by decomposing large DFT into several stages of smaller DFTs Often provided as a highly optimized library
Dan Ellis
2013-11-27
nk X [k ] = # x [n] ! WN
k = 0.. N-1
= =
m =0 N "1 2 m =0
# ( x[2m ]
2 mk ! WN
+ x [2m + 1] ! WN
N "1 2
(2 m +1) k
mk k mk x 2 m ! W + W x 2 m + 1 ! W ] N # [ ] N N # [
2
m =0
Dan Ellis
k + WN DFTN 2
{x1 [n]}
We can evaluate an N-pt DFT as two N/2-pt DFTs (plus a few mults/adds) But if DFTN{} ~ O(N2) then DFTN/2{} ~ O((N/2)2) = 1/4 O(N2) Total computation ~ 2 ! 1/4 O(N2) = 1/2 the computation (+) of direct DFT
Dan Ellis
2013-11-27
[ ]
N 2
k + WN X1
[ ]
k
N 2
DFTN
2
X[0] X[1] X[2] X[3] X[4] Same as X[5] X[0..3] except for X[6] factors on X[7] X1[]
DFTN
2
terms
10
If decomposing one DFTN into two smaller DFTN/2s speeds things up ... Why not further divide into DFTN/4s ? k i.e. X [k ] = X0 k N + WN X1 k N
[ ] [ ] make: X [k ] = X [ k ] + W X [ k ]
0!k<N
2 2
00
0 ! k < N/2 N/4-pt DFT of even points N/4-pt DFT of odd points from even subset in even subset of x[n]
N 4
N 2
01
N 4
Similarly, X1 [k ] = X10 k
2013-11-27
[ ]
N 4
+ WNk X11 k
2 11
[ ]
N 4
Dan Ellis
DFTN X 00
4
0 WN /2
DFTN X01
4
same as before
0 WN 1 WN 2 WN 3 WN 4 WN 5 WN 6 WN 7 WN
DFTN X 10
4
DFTN X11
4
Dan Ellis
2013-11-27
12
DFT2
" N = 2M-pt DFT reduces to M stages of twiddle factors & summation (O(N2) part vanishes) " real mults < M4N , real adds < 2!M2N " complexity ~ O(NM) = O(Nlog2N)
Dan Ellis 2013-11-27 13
1 = W20 -1 = W21
=e
!j !j
N 2 "r N !j 2 "N / 2 N
Can simplify:
XX0[r] XX1[r] XX[r]
=e #e r = !WN
just one cpx mult! WNr -1 XX[r+N/2] i.e. SUB rather than ADD
2013-11-27 14
Dan Ellis
bit-reversed indexing
W4 W4
W8 2 W8 3 W8
-1s absorbed into summation nodes WN0 disappears in-place algorithm: sequential stages
2013-11-27 15
Dan Ellis
Having N = 2M meant we could divide each stage into 2 halves = radix-2 FFT Same approach works for:
! ! !
Composite N = abcd " mixed radix (different N/r point FFTs at each stage)
!
Dan Ellis
Inverse FFT
!
N !1
"
k =0
Forward DFT of x#[n] = X*[k]|k=n i.e. time sequence made from spectrum
! nk * X [k ]WN
) = "X
k =0
Re -1 Im
N !1
nk [k ]WN
x [n] =
1 N
X [k ]
*
nk WN
k =0
Re{X[k]} Im{X[k]}
2013-11-27
DFT
Re Im
1/N
-1/N
Re{x[n]} Im{x[n]}
17
Dan Ellis
If x[n] is pure-real, DFT wastes mults Real x[n] " Conj. symm. X[k] = X*[-k] Given two real sequences, x[n] and w[n] call y[n] = jw[n] , v[n] = x[n] + y[n] N-pt DFT V[k] = X[k] + Y[k] X[k] -Y[k] but: V[k]+V*[-k] = X[k]+X*[-k]+Y[k]+Y*[-k] X[k]=1/2(V[k]+V*[-k]) , W[k]=-j/2(V[k]-V*[-k]) i.e. compute DFTs of two N-pt real sequences with a single N-pt DFT
2013-11-27 18
Dan Ellis
Fourier Transform (e.g. DTFT) gives spectrum of an entire sequence: How to see a time-varying spectrum? e.g. slow AM of a sinusoid carrier:
2 1 0 -1 -2 0 200 400 600 800 1000
x[n]
n
19
Dan Ellis
2013-11-27