Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

GETTING THE RESULT OF LINEAR CONVOLUTION USING DFT

Let [] and [] be 1 -point and 2 -point sequences and [] be their linear


convolution.
Let [] and [] be -point DFTs of [] and [].
The IDFT of [] = [][] is the same as the linear convolution of [] and
[] if 1 + 2 1.

ilolu

Ex: Let [] and [] be 5-point and 9-point sequences, respectively. At least


how many point DFT has to be used to get the result of their linear convolution?

Answer: 5+9-1=13 point DFT.

However, if, for example, 10-point DFT used then


The result has 10 samples in total
The first 13-10 = 3 samples out of these 10 samples are not equal to the
those of the linear convolution
The remaining 10-3 samples are equal to those of the linear convolution.
Therefore only 7 samples of the result of linear convolution (13 samples)
will be obtained.

ilolu

MATLAB Example

x = [1 2 3];

y = [-1 2 1 2];

z = conv(x,y);

z = -1

2 10

X = fft(x,6)
X = 6 0.5-4.3i

-1.5 + 0.9i

-1.5-0.9i

0.5+4.3i

Y = fft(y,6)
Y=4

-2.5 - 2.6i

-0.5 - 0.9i

-4

-0.5 +0. 9i

-2.5 + 2.6i

-12.5 +9.5i

1.5 + 0. 9i

-8

1.5 -0. 9i

-12.5 - 9.5i

Z=X.*Y
Z =24
z_=ifft(Z)

z = -1

2 10

X = fft(x,5)
X =6

-0.8 -3.7i

0.3+1.7i

0.3-1.7i

-0.8+3. 7i

Y =4

-2.8 - 1.3i

-1.7 - 2.1i

-1.7 + 2.1i

-2.8 + 1.3i

Z =24

-2.5 + 11.4i

3.0 - 3.5i

3.0 + 3.5i

-2.5 - 11.4i

Y = fft(y,5)

Z = X.*Y

z_= ifft(Z)

ilolu

z_ =

2 10

7) Sampling the DTFT

DTFT
xn
X e j

length N X

Let

X k X e j

2
N

k 0,1,..., N 1

where is arbitrary, i.e. not necessarily !

[] = ? ? ?
(-point IDFT of [])

ilolu

[] = {

1
=0 [ ]

= 0,1, , 1

. .

[] = ( [] )
=0

=0

1
()

= [] (
=0
=


= []

= ( [] [ ])
=

= [ ]
=

Therefore


xn mN
xn m
0

ilolu

n 0,1,..., N 1
o.w.

Ex: = 6, = 4

x n

xn m4

xn

5
j
1 e j 6 e j 3 e j 3 e j 3
sin 3
2
X e

j
j
j
1 e j
2
2
2
sin
e
e e
2
j

For N = 4

X 0 6 X 1 1 j

X 2 0

X 3 1 j

and

x4 n :

ilolu

0 0 2 2 11 0 0
n 0

Ex: Demonstration of the proof.


= 8, = 5

xne

X e

jn

n 0

xne

jn

X k X e j

2
5

xnW

kn
5

x0 x1W5k x2W5k 2 x3W5k 3 x4W5k 4 x5W5k 5 x6W5k 6 x7W5k 7

W5k 0

x0 x5

W5k 1

W5k 2

x1 x6W5k

x2 x7W5k 2
x3W5k 3

x4W5k 4

This is the 5-point DFT of

x0 x0 x5
x1 x1 x6
x2 x2 x7
x3 x3
x4 x4

ilolu

8) Multiplication in Time Domain

DFS
Let x1 n and x2 n be periodic with common period N.

x3 n x1 n x2 n

1 N 1

X 3 k X 1 l X 2 k l
N l 0
DFS

DFT

Let x n and

x2 n

point DFTs,

N max N1 , N2 .

x3 n x1 n x2 n

ilolu

be two finite length sequences and

X1 k

and

1 N 1

X 3 k X 1 l X 2 k l N
N l 0
N -point DFT

X 2 k

their N-

k 0,1,..., N 1

IMPLEMENTING LTI SYSTEMS USING DFT


The output of an LTI system can be computed using DFT:

Multiply the DFTs of input and impulse response and compute the IDFT

There are efficient DFT computation techniques.

We consider FIR systems with long inputs.

ilolu

BLOCK PROCESSING

Input is decomposed into short segments and the output is computed by


properly combining the responses to the short segments.

Otherwise, it is not practical to consider DFTs of very long sequences.


Furthermore the output of the system will be delayed excessively since all the
input has to be collected first..
h[n]: length P.
The input is decomposed into blocks of length L.

ilolu

10

Two Methods

Overlap-Add

DFT length:

L+P-1 point

DFT length:

L point

Overlap-Save

ilolu

11

OVERLAP-ADD METHOD
Lets start with a linear convolution example
hn: ..., 0, 0, 1 , 2, 3, 0, 0,...

3-point sequence (P = 3)

n 0

xn: ..., 0, 0, 1 , 1, 2, 2, 1, 1, 0, 0 ,...

n 0

Linear convolution:

6+3-1 = 8 points

1 2 3
6
2
4
2 4 6
1 2 3
1 2 3
3 1
1 1
1 7 1 3

n 0

yn : ..., 0, 0, 1 , 1, 3, 1, 1, 7, 1, 3 , 0, 0...

n 0

ilolu

12

By Overlap-add:
hn: ..., 0, 0, 1 , 2, 3, 0, 0,...

3-point sequence (P = 3)

n 0

xn: ..., 0, 0, 1 , 1, 2, 2, 1, 1, 0, 0 ,...

(In general, infinite length, starts at n = 0)

n 0

Decompose the input, x[n], into L-point segments.


Lets choose L= 3; could be something else...

xn : ..., 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 ,...

x1

x2

Compute the 5-point (L+P-1) DFTs of x1 and x2

Compute the 5-point

DFT of h

X1 and X2

Compute
y1 = IDFT{ H X1 }

y1 : ..., 0, 0, 1, 1, 3, 1, 6, 0, 0 ,...

y2 = IDFT{ H X2 }

y2 : ..., 0, 0, 0, 0, 2, 5, 7, 1, 3, 0, 0 ,...

and

Compute y[n] by overlap-add, i.e,


1 1 3

1
6
2 5 7 1 3

1 1 3 1 1 7 1 3

n 0

ilolu

13

Overlap Add Formally

Let the impulse response of the system be of length P samples.


Decompose the input x n into nonoverlaping, consecutive blocks of length L.

r th

block is

x n rL

xr n

0nL
o.w.

Compute the (L+P-1)-point DFT of h n ,

For the

r th

so that

x n xr n rL
r 0

H k

block, the output is found by (L+P-1)-point IDFT of Yr k H k X r k ,

yr n

y0 n , y1 n , y2 n , ...

The overall output is formed as y n yr n rL y0 n y1 n L y2 n 2L ...


r 0

ilolu

14

Overlap Add Pictorially

input segments
n0

L samples

L P 1 samples

output segments

ilolu

15

OVERLAP-SAVE METHOD
Ex:
hn: ..., 0, 0, 1 , 2, 3, 0, 0,...

3-point sequence (P = 3)

n 0

xn: ..., 0, 0, 1 , 1, 2, 2, 1, 1, 0, 0 ,...

(In general, infinite length, starts at n = 0)

n 0

Decompose the input, [], into -point segments ( ).


Choose = 4, could be something else...
In overlap-save method, we use -point DFTs
Therefore, the first ( + 1) = 1 samples for each output segment
will be incorrect. In this example, the first 2 samples...

Because of the two incorrect samples at each output block, the first segment is
choosen to start at = ( 1) = 2

xn: ..., 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 ,...

x1

then, the second segment is chosen as

x2

xn: ..., 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 0, 0 ,...

x1

which overlaps wih the previous segment by two samples


ilolu

16

Compute the 4-point DFTs of 1 , 2 , 3 , 4 , 5 , . ..

1 , 2 , 3 , 4 , 5 , . ..

DFT of

Compute the 4-point

Compute
1 = { 1 }

y1 : ..., 0, 0, 1, 3, 1, 1, 0, 0 ,...

2 = { 2 }

y2 : ..., 0, 0, 3, 5, 3, 1, 0, 0 ,...

3 = { 3 }

y3 : ..., 0, 0, 1, 5, 1, 7, 0, 0 ,...

4 = { 4 }

y4 : ..., 0, 0, 1, 1, 1, 3, 0, 0 ,...

5 = { 5 }

y5 : ..., 0, 0, 0, 0, 0, 0, 0, 0 ,...

Compute [] by saving the correct samples,

saved

1
3

1
5

3
1
3

1
5
1

1
1
1

7
1
7

1
1

3
3

n 0

yn: ..., 0, 0, 1 , 1, 3, 1, 1, 7, 1, 3, 0, 0...

n 0

ilolu

17

OVERLAP SAVE FORMALLY


Let

<+1

( )

The first ( + 1 ) samples of -point IDFT are incorrect.


In particular, if = , 1 samples are incorrect.

So, choose the first input segment, x0 n , as


x P 1, x P 2,...,x 1, x0, x1,...,xL P

L samples

i.e,

x0 n xn P 1

0 n L 1

Compute its L-point DFT

X 0 k

Compute the L-point DFT of h

H k

Compute

y 0 n L-point IDFT of X 0 k H k .

Discard the first (P-1) samples to get the first ouput segment

y n
y0 n 0

P 1 n L 1
o.w.

then the first (L-(P-1)) samples of the output are


y n y0 n P 1

n 0,1,..., L P 1 1

Then take the second input segment as

xL P P 1 1, ..., x2L 2 P 1

L samples

i.e.
ilolu

xL 2P 2, ...,x2L 2P 1
18

and continue the process...

Overlap Save Pictorially


input segments

n0

L samples

P1 zeros

P1 samples

input segments
P -1 samples discarded

output segments

ilolu

19

LINEAR CONVOLUTION AND CIRCULAR CONVOLUTION


We know the following
[] ( )
[] ( )

( ) = ( )( )

[] = {( )}
= [ ] [ ]

ilolu

20

Now, the question is


[] =?
[] = {
[][]}
[]

where
[] = (( )( ))|

2
=

= 0,1, , 1

ilolu

21

We know that IDFT yields

[ ]
[] =

ilolu

= 0,1, , 1

. .

22

Therefore -point circular convolution of [] and [] can also be computed


via linear convolution:

Compute
[ ] = [ ] [ ]

Then, you can find [] [] as

[ ]
[ ] [ ] =

= 0,1, , 1

. .

or as
[] [] = {[][]}

ilolu

23

Ex:
[] = [ 0 0

2 0 0 ]

=0

[] = [ 0 0 2
1 1 0 0 ]
=0

a) Let [] and [] be 5-point DFTs of [] and [], respectively.


Find the sequence [] = {[] []}.
b) Let [] and [] be 3-point DFTs of [] and [], respectively. Find the
sequence [] = {[] []}

c) Let
[] = ( )|
[] = ( )|

2
= 2

= 0,1

2
2

= 0,1

Find the sequence [] obtained by applying 2-point inverse DFT operation to


[] [].

ilolu

24

a)
[ ] = [ ] 5 [ ]
4

= [] [(( ))5 ]

= 0,1,2,3,4

= [0] [(())5 ] + [1] [(( 1))5 ]

= 0,1,2,3,4

=0

2
1 1 0 0
0 4 2 2 0
2 3 3 2 0

Therefore
[] = [ 0 0 2
3 3 2 0 0 ]
=0

Or, since the linear convolution of [] and [] yields (3+2-1) 4-point


sequence and the DFTs are 5-point, 5-point circular convolution and linear
convolution yields the same result.
[ ] = [ ] 5 [ ]
= [ ] [ ]
= []

ilolu

25

b)
[ ] = [ ] 3 [ ]
2

= [] [(( ))3 ]

= 0,1,2

= [0] [(())3 ] + [1] [(( 1))3 ]

= 0,1,2

=0

2
1 1
2 4 2
0 3 3

Therefore

[] = [ 0 0 3
3 0 0 ]
=0

or
[ ] = [ ] 3 [ ]

[ 3]
=

= 0,1,2

{ 0

. .

n 0 n 1 n 2

ilolu

2 3 3

2
0

2
2 3 3 2
3

26

c)
1

2
1
[] [] 2
2

[ ] =

= 0,1

=0

. .

[ 2]
=

= 0,1

=0

. .

where
[ ] = [ ] [ ]
(linear conv.)

Therefore
n 0 n 1

2 3

3
1

2
3

[] = [ 0 0

3 2
2 3 3 2

1 3 0 0 ]
=0

ilolu

27

You might also like