Finite-length Discrete Transforms
Chapter 5 Sections 5 2 5 10 Chapter 5, Sections 5.2 - 5.10 D I d J f
- Dr. Iyad Jafar
Finite-length Discrete Transforms Chapter 5 Sections 5 2 Chapter 5, - - PowerPoint PPT Presentation
Finite-length Discrete Transforms Chapter 5 Sections 5 2 Chapter 5, Sections 5.2 - 5.10 5 10 D I Dr. Iyad Jafar d J f Outline Outline The Discrete Fourier Transform (DFT) Matrix Representation of DFT Finite-length Sequences
Chapter 5 Sections 5 2 5 10 Chapter 5, Sections 5.2 - 5.10 D I d J f
2
In practice, we usually deal with finite-length sequences,
N 1
N 1 j j n n 0
X(e ) x[n] e
|X(ejω)| …. ….
However, X(ejω) is a periodic and continuous function of
ω 2π
How about processing of digital signals in How about processing of digital signals in
3
j
|X(ejω) | ω 2 …. ….
Alternatively, consider working with one period of X(ejω) !
ω 2π
Δω
y, g p ( ) Still, we have infinite points?
Take N equally-spaced samples from X(ejω) over the range [0,
q y p p ( ) g [ , 2π]
Accordingly, the spacing between the samples is
g y, p g p Δω = 2π / N
And the normalized angular frequency for each sample is And the normalized angular frequency for each sample is
ω = 2π k / N , 0 ≤ k ≤ N-1
4
Mathematically,
j 2 k
X[k] X(e )
2 kn j N
x[n] e , 0 k N-1
N
n 0
[ ] ,
Note that the DFT Always exists since it is a finite sum!
When computing the DFT, all samples in x[n] are used
5
6
1 , n = 0 [ ] ⎧ ⎨ x[n] 0 , 1 n N-1 ⎨
7
The inverse N-point Discrete Fourier Transform (IDFT) is
given by
N 1 2 kn j
1
V ifi i !
j N k 0
1 x[n] X[k] e , 0 n N-1 N
Verification!
N 1 2 kn j N
1 x[n] X[k] e , 0 n N-1 N
k 0
N
N 1 N 1 2 km 2 kn j j N N
1 x[n] x[m] e e n N 1
⎞
⎟ ⎜ ⎟
k 0 m 0
x[n] x[m] e e , 0 n N-1 N
⎟ ⎜ ⎟ ⎝ ⎠
N 1 N 1 2 k(m n)
1
⎞
N 1 N 1 2 k(m n) j N m 0 k 0
1 x[n] x[m] e , 0 n N-1 N
⎞
⎟ ⎜ ⎟ ⎝ ⎠
8
x[n] x[n]
when m = n
The DFT is given by
N 1 2 kn j
Let W = e-j2π/N so the DFT becomes
j N n 0
X[k] x[n] e , 0 k N-1
Let WN = e j2π/N, so the DFT becomes
N 1 kn N
X[k] x[n] W , 0 k N-1
In matrix form
N n 0
[ ] [ ] ,
x[0] x[1] ⎡ ⎤ ⎢ ⎥ ⎢ ⎥
k 2k 3k (N 1)k N N N N
X[k] 1 W W W ... W x[2] ...
⎥ ⎢ ⎥ ⎡ ⎤ ⎣ ⎦ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
9
x[N 1] ⎢ ⎥
⎦
In general, the DFT can be written as
n = 0 n = N-1
1 1 1 1 ... 1 x[0] ⎡ ⎤ ⎡ ⎢ ⎥ ⎢ ⎤ ⎥
n 0 k = 0
2 3 (N 1) N N N N 2 4 6 N N N
1 W W W ... W X[k] 1 W W W ...
N
x[1] W x[2]
⎥ ⎢ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
N 1 2(N 1) 3(N 1) (N 1)(N 1) N N N N
... ... x[N 1] 1 W W W ... W
⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎣ ⎦ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎦
k = N-1
⎣ ⎦
N
X[k] = D x
where DN is called the DFT matrix
10
For the inverse DFT
X[k] D
1 1 N
X[k] = D x
1 1 N N N
D X[k] = D D x
h f D
1 N
x[n] = D X[k]
1 1 1 1 ... 1 ⎡ ⎤
1 2 3 (N 1) N N N N 1 2 4 6
1 W W W ... W 1 D 1 W W W
W
⎤ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
N N N N
D 1 W W W N
) N (N 1) 2(N 1) 3(N 1) (N 1)(N 1)
... W ... ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
11 (N 1) 2(N 1) 3(N 1) (N 1)(N 1) N N N N
1 W W W ... W
⎥ ⎢ ⎥ ⎣ ⎦
12
Note 1. The N-point DFT is computed from the DTFT
j 2 k
N
13
Note 3. For a finite length sequence x[n], 0 ≤ n ≤ N-1,
y[n] x[n mN] , 0 n N - 1
kl N l
Y[k] x[l] W
l M 1
1
kn N k 0
1 q[n] Y[k] W , 0 k N 1 N
M 1 kl k
1
⎞ ⎜ ⎟
kl kn N N k 0 l
1 q[n] x[l] W W , 0 k N 1 N
⎞
⎟ ⎜ ⎟ ⎝ ⎠
M 1 k(n l) N
1 q[n] x[l] W , 0 k N 1 N
⎞
⎟ ⎜ ⎟ ⎝ ⎠
l k 0
N
⎠
M 1
⎧
M 1 k(n l) N k 0
1 , l = n + mN 1 W 0 , otherwise N
⎨ ⎩
~
q[n]= y[n] x[n mN] n N 1
15 m
q[n] y[n] x[n mN] , 0 n N 1
Note 4. To compute the M-point DFT for a length-N
x[n] X[k] y[n]
[ ] [ 8] [ 4] [ ] [ 4] [ 8]
m
y[n] x[n mN] , 0 n N 1
16
y[n] + x[n+8] + x[n+4] + x[n] + x[n-4] + x[n-8] … …
Example 5.4: Continued.
0.5 1 1.5
y[n]
1 1.5
x[n+4] y[n]
0.5 1
1 1.5
2 4 6 8
n
1
0.5
x[n] +
1 5
1 1.5
2 4 6 8
n
2 4 6 8
n
0.5 1
x[n-4]
17
2 4 6 8
n
Example 5.5: consider x[n] = {1 , -1 , 1 , 1}, N = 4. If we compute the 2-point DFT X[k], then the IDFT, p p [ ], , x[n] X[k] y[n] [ ] [ ] y[ ]
[ ] [ N] N 1
m
y[n] x[n mN] , 0 n N 1
y[n] + x[n+4] + x[n+2] + x[n] + x[n-2] + x[n-4] … …
18
Example 5.5: Continued.
[ 2] y[n]
0.5 1 1.5
2.5
x[n+2] y[n]
1.5 2
1 1.5
2 4 6 8
n
0.5 1
0.5
x[n] +
0 5
2 4 6 8
n 1 1.5
2 4 6
n
x[n-2]
0.5
19
2 4 6 8
n
Given a finite-length sequence x[n], 0 ≤ n ≤ N -1, we can
N
y[n] x[ n ]
How to compute <n>N ?
For positive n, straight forward! For negative numbers, let r = n + kN, where k is an integer,
then compute the smallest k such that 0 ≤ r ≤ N -1
Example 5.6
<-15>7 = ?? 15 + k * 7 f k 3 6 r = -15 + k * 7 for k = 3 r = 6 <-15>7 = 6
20
Example 5.7: Determine y[n] = x[<-n>5] for
3 4 5 n]
5]
1 2 x [n
2 4 n
3 4 5 [n]
[N ] 1 N 1 ⎧
1 2 y [
N
x[N - n] , 1 n N - 1 x[ n ] = x[n] , n = 0
⎨ ⎩
21
2 4 n
22
Given a finite-length sequence x[n], 0 ≤ n ≤ N -1, we can
y[n] x[ n - n ]
x[n - n ] n n N - 1
n N - 1 x[ n - n ] x[N + n - n ] , 0 n < n
For no < 0
x[N + n - n ] , n n N - 1 x[ n - n ] x[n + n ] n n
23
n n
Example 5.8: let x[n] = {-1 , 0 , 1 , 2}, determine
4
y[n] x[ n - 2 ]
4
y[n] x[ n 2 ]
4]
4]
1 2 n] 1 2 n] x [n y [n
24
1 2 3 4
n
1 2 3 4
n
A complex finite-length sequence x[n], 0 ≤ n ≤ N -1, is
A complex finite-length sequence x[n], 0 ≤ n ≤ N -1, is
* * N N
x[n] x [ n ] x [ N n ]
* * N N
x[n]
n ]
N n ]
N N
[ ] [ ] [ ]
cs ca
x[n] x [n] x [n]
cs N
1 x [n] = x[n] x [ n ] 2
ca N
1 x [n] = x[n] x [ n ] 2
A real finite-length sequence x[n], 0 ≤ n ≤ N -1, is called
A real finite-length sequence x[n] 0 ≤ n ≤ N -1 is called
N N
x[n] x[ n ] x[ N n ]
x[n] x[ n ] x[ N n ]
N N
x[n]
n ]
N n ]
ev
x[n] x [n] x [n]
N
1 x [n] = x[n] x[ n ] 2
N
1 x [n] = x[n] x[ n ] 2
Example
27
Given a finite-length sequence x[n], 0 ≤ n ≤ N -1, with its
X(ejω) being its DTFT and X[k] being its N-point DFT
Similarly, let h[n], 0 ≤ n ≤ N -1, be the impulse response of
LTI h H( jω) b DTFT d H[k] b LTI system with its H(ejω) being its DTFT and H[k] being its N-point DFT
We know from the convolution theorem that the output of
the system y[n] due to the input x[n] y y[ ] p [ ] y[n] = x[n] h[n] Y(ejω) = X(ejω) H(ejω)
*
However, is it true that
y[n] = x[n] h[n] ?????? Y[k] = X[k] H[k]
*
y[ ] [ ] [ ] [ ] [ ] [ ]
28
x[n]
N-point DFT
X[k]
IDFT
x[n]
… n
h[n]
X[k]
n … …
N-point DFT IDFT
h[n]
n
h[n]
DFT
H[k]
… …
This implies that
n
… … N-1
29
n N-1 Wrap around error
[ ] [ ] N h[ ]
This is called N-point circular convolution,
N 1
y[n] x[n] N h[n] = x[n] * h[n] = x[m] h[<n m> ]
m 0
= x[n] * h[n] = x[m] h[<n-m> ]
where the sequence y[n] is of length N and is computed over where the sequence y[n] is of length N and is computed over 0 ≤ n ≤ N -1.
Circular convolution of length-N finite sequences requires
Circular time-reversal Circular time-shift Multiplication
p
Addition
30
Example 5.10: let x[n] = {1 , 2 , 0 , 1} and h[n] = {2 ,
3 4
y [n] x[n] N h[n] = x[m] h[<n-m> ]
c 4 m 0
y [n] x[n] N h[n] x[m] h[ n m ]
31
Can we implement linear convolution between two
finite length sequences using circular convolution? Simply, we need to prevent the wraparound errors ! This can be simply done by padding the two sequences with M zeros be simply done by padding the two sequences with M zeros where M ≥ N – 1. This implies that when the IDFT is computed from the DFT
the padded zeros. Accordingly, wraparound errors are canceled when one sequence is shifted in convolution.
32
x[n]
N-point DFT
X[k]
IDFT
x[n]
… n
h[n]
X[k]
n … …
N-point DFT IDFT
h[n]
n
h[n]
DFT
H[k]
… …
This implies that
n
x[n] * h[n] X[k] H[k]
x[n] * h[n] X[k] H[k]
… … N-1
33
n N-1
So why do we care about circular convolution?
To perform linear convolution between two finite length p g sequences using their DFT, the sequences have to be padded with at least N-1 zeros.
Example 5.11: x[n] = {1 2 0 1} h[n] = {2 2 1 1}. The linear convolution result The circular convolution result The circular convolution result of the padded sequences
34
xn is a complex sequence sequence
35
xn is a real sequence
36
37
Example 5.12: Compute G[k] and H[k] of the following
38
Example 5.13:
39
Example 5.14: The 134-point DFT for a real sequence x[n] is
known to be zero except at the following values of k. Determine
k
k k k
k1 , k2 , k3 , k4 A, B , C, D , E The DC value
k X[k] 3.42 - jA
The DC value
The energy of x[n]
17 4.52 + j7.91 k1
k2 j3.78 47
67 45 + jB 67 45 + jB k3 E – j7.91 79
79
108 C + j7.56 k4
40
4
j
41