Circular and Linear Conv DFT
Circular and Linear Conv DFT
DFT: 0 1
00 0n 0(N 1)
0 1 WN ··· WN ··· W 0 1
X[0] B N C x[0]
B C B . . . CB C
B . C B . . CB . C
B . C B . . . . . CB . C
B C B . . . . . CB C
B . C B CB . C
B X[k] C = B
B WNk0 ··· WNkn ··· W
k(N 1) CB
CB x[n] C
B C B N CB C
B C B CB C
B . C B . . . CB . C
B . C B . . C@ . C
@ . A B . . . . . C . A
@ . . . . . A
X[N 1] (N 1)0 (N 1)n (N 1)(N 1) x[N 1]
W ··· W ··· W
N N N
IDFT: 0 0(N 1) 1
00 0k
0 1 W ··· W ··· W 0 1
x[0] B N N N C X[0]
B C B . . . CB C
B . C B . . CB . C
B . C B . . . . . CB . C
B C B . . . . . CB C
B . C 1 B CB . C
B C = B n0 nk n(N 1) CB C
B x[n] C B W ··· W ··· W CB X[k] C
B C N B
B
N N N CB
CB C
B . C B . . . CB . C
B . C B . . C@ . C
@ . A B . . . . . C . A
@ . . . . . A
x[N 1] (N 1)0 (N 1)k (N 1)(N 1) X[N 1]
W ··· W ··· W
N N N
1 ⇤ 1 ⇤ 1
x = WN X = WN WN x = (N I) x = x
N N N
WHY?
as expected.
M. Lustig, EECS UC Berkeley
Properties of DFT
• Linearity
j(2⇡/N )km km
x[((n m))N ] $ X[k]e = X[k]WN
x !n "
~ x !n # m"
~
n n
0 N #1 0 m N #1
• Complex Conjugation
⇤ ⇤
x [n] $ X [(( k))N ]
0 1 2 3 k
X[k]
• 5-point DFT
···
–Symmetry
0 1 2 3 4 k
0 1 2 3 k
R X[k]
• 5-point DFT
···
–Symmetry
0 1 2 3 4 k
• Parseval’s Identity
N
X1 N
X1
12
|x[n]| = |X[k]|2
n=0
N
k=0
• Circular Convolution:
N
X1
x1 [n] N x2 [n] = x1 [m]x2 [((n m))N ]
m=0
x1 [n]
1
0 1 2 3 4 5 6 n
x2 [n]
1
0 1 2 3 n
y[n] = x1 [n] 7 x2 [n] =?
x1 [n]
1
0 1 2 3 4 5 6 n
x2 [n]
1
0 1 2 3 4 5 6 n
x1 [n]
1
0 1 2 3 4 5 6 n
x2 [n]
1
0 1 2 3 4 5 6 n
0 1 2 3 4 5 6 n
• Next....
– Using DFT, circular convolution is easy
– But, linear convolution is useful, not circular
– So, show how to perform linear convolution
with circular convolution
– Use DFT to do linear convolution
x1 [n]
1
L=5
0 1 2 3 4 n
x2 [n]
1
P=4
0 1 2 3 n
M=L+P-1=8
x1 [n]
1
0 1 2 3 4 5 6 7 n
x2 [n]
1
0 1 2 3 4 5 6 7 n
M=L+P-1=8
x1 [n]
1
0 1 2 3 4 5 6 7 n
x2 [n]
1
0 1 2 3 4 5 6 7 n
Circular ‘flip’
M=L+P-1=8
y[n] = x1 [n] 8 x2 [n] = x1 [n] ⇤ x2 [n]
M. Lustig, EECS UC Berkeley
Linear Convolution via Circular Convolution
• Problem:
– An input signal x[n], has very long length
(could be considered infinite)
– An impulse response h[n] has length P
– We want to take advantage of DFT/FFT and
compute convolutions in blocks that are
shorter than the signal
• Approach:
– Break the signal into small blocks
– Compute convolutions
– Combine the results
M. Lustig, EECS UC Berkeley
olution
Convolution
Convolution
Block Convolution
ple:
ple:
Example:
pulse Response, Length P =Length
Impulse Response, 6 P = 6
h[n] Impulse response, Length P=6
Impulse Response, Length P = 6
0 10 1020 2030 30
0 10 20 30
n n
x[n] Input Signal, Length P=33
Input Signal, Length
Input
n
33 Length 33
Signal,
Input Signal, Length 33
y[n] Output Signal,
LinearLength
Linear Convolution, P=38
Length 38 Length 38
Convolution,
Linear Convolution, Length 38
5 0.5 0.5
0.5
y[n]
0 0
y[n]
y[n]
0
5 -0.5 -0.5
-0.5
0 10 1020 2030 30 0 0 10 10 20 20 30 3
0 10 20 30 0 10 20
n n n n
n n
0.5
x0[n]
⇢
x0[n]
0
0 otherwise
Block Convolution 0 10
n
20 30
0.5
x1[n]
Example:
x1[n]
0
-0.5
0.5
0.5
x2[n]
sum of segments
xh[n]
0
[n]
0
2
-0.5
-0.5
0 10 20 30
1
n
X 0 10
n
20
x[n] = x0[n]+x1[n]+x2[n]
Input Signal, Length 33
30
Overlap-Add, Sum of Input Segments
x[n] = xr [n]
0.5
0.5
x[n]
r=0 -0.5
x[n]
0
0 10 20 30
n
0.5
x0[n] 0.5
x0[n]
y0[n]
0 0
0.5 -0.5
Convolution
Convolution
0 10
n
20 30 0 10
n
20 30
y1[n]
0 0
0.5 -0.5
ImpulseResponse,
Impulse Response,Length
LengthPP ==66
0 10 20 30 0 10 20 30
n n
0.5
0.5
0.5
x2[n] 0.5
x2[n]
00
y2[n]
0 0
0.5 -0.5
-0.5
0.5
0 10 20 30 0 10 20 30
n n
00 10
10 20
20 30
30
Overlap-Add, Sum of Input Segments Overlap-Add, Sum of Output Segments
0.5
Input
nn
x[n] = x0[n]+x1[n]+x2[n]
Input Signal,
Signal,Length
Length33
33
0.5
y[n] = y0[n]+y1[n]+y2[n]
LinearConvolution,
Linear Convolution,Length
Length 38
38
0.5
0.5 0.5
0.5
y[n]
0 0
0.5 -0.5
y[n]
00 00
y[n]
0 10 20 30 0 10 20 30
n n
0.5
-0.5 -0.5
-0.5
Course Notes by J.M Kahn Fall 2012, EE123 Digital S
00 10
10 20
20 30
30 00 10
10 2020 30
30
nn nn
Overlap-Save Method
• Basic idea:
• Split input into (P-1) overlapping segments
with length L+P-1
⇢
x[n] rL n < (r + 1)L + P
xr [n] =
0 otherwise
0 1 2 3 4 5 6 n
x2 [n]
1
0 1 2 3 4 5 6 n
4
Valid linear convolution!
2
0 1 2 3 4 5 6 n
M. Lustig, EECS UC Berkeley
veExample
Methodof overlap and save:
y0p[n]
x0[n]
0 0
-0.5 -0.5
0 10 20 30 0 10 20 30
n n
y1p[n]
x1[n]
0 0
-0.5 -0.5
0 10 20 30 0 10 20 30
n n
Usable (y2 [n])
Unusable
0.5 0.5
y2p[n]
x2[n)
0 0
-0.5 -0.5
0 10 20 30 0 10 20 30
n n
Overlap-Save, Concatenation of Usable Output Segments
0.5
y[n]
-0.5
0 10 20 30
n
sed on Course Notes by J.M Kahn Fall 2012, EE123 Digital Signal Proce