22
DT Convolution (1B) Circular Convolution Numerical Convolution Moving Average Filter

DT Convolution (1B) Convolution 3 (1B) Linear Convolution using the DFT Young W. Lim 2/5/14 x[n] h[n] y[n] y[n] = ∑ k=−∞ +∞ h[k] x[n −k] x[n] 0 ≤ n≤ L−1 h[n] 0 ≤

Embed Size (px)

Citation preview

DT Convolution (1B)

● Circular Convolution ● Numerical Convolution● Moving Average Filter

Young W. Lim2/5/14

2DT Convolution (1B)

Copyright (c) 2013 Young W. Lim.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Please send corrections (or suggestions) to [email protected].

This document was produced by using OpenOffice and Octave.

3DT Convolution

(1B)

Linear Convolution using the DFT

Young W. Lim2/5/14

x [n ] y [n ]h[n]

y [n] = ∑k=−∞

+ ∞

h [k ] x [n − k ]x [n ] 0 ≤ n ≤ L−1

h [n] 0 ≤ n ≤ M−1

y [n] 0 ≤ n ≤ L+M−2

x [n]

L

Pad with(M-1) zeros

x zp [n ]N-pointDFT

X [k ]

h [n ]

MPad with(L-1) zeros

h zp[n ]N-pointDFT

H [k ]

Y [k ] y [n ]

NN = L+ M−1 X N-point

IDFT

Y (e jω) = H (e jω

)X (e jω)

4DT Convolution

(1B)

Circular Convolution using the DFT

Young W. Lim2/5/14

x [n ] y [n ]h[n]

y [n] = ∑k=−∞

+ ∞

h [k ] x [n − k ]

x [n ] 0 ≤ n ≤ L−1h [n] 0 ≤ n ≤ M−1y [n] 0 ≤ n ≤ L+M−2

Y (e j ω̂) = H (e j ω̂

)X (e j ω̂)

Y [k ] = Y (e j2πk/N) 0 ≤ k ≤ N−1

H [k] = H (e j2πk /N) N−M 0 ' s

X [k] = X (e j2πk/N) N−L 0 ' s

y [n] = ∑m=0

N−1

h[m ] x [ ⟨n− k⟩N ] 0 ≤ n ≤ N−1

y [n] = h [n] N x [n]

DTFT

N-pointDFT

continuous frequency variable

sampled frequency variable

ω̂

k

Linear Convolution

Circular Convolution

Y [k ] = H [k]X [k]

5DT Convolution

(1B)

Circular Convolution using the DFT

Young W. Lim2/5/14

y [n] = ∑k=−∞

+ ∞

h [k ] x [n − k ]

Y (e j ω̂) = H (e j ω̂

)X (e j ω̂)

y [n] = ∑m=0

N−1

h[m ] x [ ⟨n− k ⟩N ]

0 ≤ n ≤ N−1

y [n] = h [n] N x [n]

DTFT

N-pointDFT

continuous frequency variable

sampled frequency variable

ω̂

k

Linear Convolution

Circular Convolution

Y [k ] = H [k]X [k]

y [n] = h [n] ∗ x [n]

6DT Convolution

(1B)

Circular Convolution (1)

Young W. Lim2/5/14

y [n] =1N

∑k=0

N−1

H [k ]X [k ]W N−kn

=1N

∑k=0

N−1

{∑m=0

N−1

h[m]WN+km}{∑

l=0

N−1

x [l]W N+kl}WN

−kn

1, m+l−n = rN

= ∑m=0

N−1

h [m] ∑l=0

N−1

x [l] { 1N ∑k=0

N−1

WN+k(m+l−n)}

{ 1N ∑k=0

N−1

WN+k(m+l−n)} =

0, otherwise

l = n−m+rN = (n−m)modN = ⟨n−m⟩N

7DT Convolution

(1B)

Circular Convolution (1)

Young W. Lim2/5/14

X1[k] = ∑n=0

N−1

x1[n ]e− j2πnk /N

X2[k] = ∑n=0

N−1

x2[n ]e− j2πnk /N

k = 0,1,⋯, N−1

k = 0,1,⋯, N−1

X3 [k] = X1 [k ]X2 [k ] k = 0,1,⋯, N−1

x3[n] =1N

∑k=0

N−1

X3[k ]e+ j2πkm/N

=1N

∑k=0

N−1

X1[k]X2[k]e+ j2πkm/N

=1N

∑k=0

N−1

{∑n=0

N−1

x1 [n]e− j2πkn/N}{∑l=0

N−1

x2 [l]e− j2πkl/N}e+ j2πkm/N

=1N

∑n=0

N−1

x1[n] ∑l=0

N−1

x2 [ l] ∑k=0

N−1

e− j2πkn/Ne− j2πkl/Ne+ j2πkm/N

=1N

∑n=0

N−1

x1 [n] ∑l=0

N−1

x2 [ l] ∑k=0

N−1

e+ j2πk(m−n−l)/N

8DT Convolution

(1B)

Circular Convolution (2)

Young W. Lim2/5/14

X1[k] = ∑n=0

N−1

x1[n ]e− j2πnk /N

X2[k] = ∑n=0

N−1

x2[n ]e− j2πnk /N

k = 0,1,⋯, N−1

k = 0,1,⋯, N−1

X3 [k] = X1 [k ]X2 [k ] k = 0,1,⋯, N−1

x [k] =1N

∑n=0

N−1

x1[n] ∑l=0

N−1

x2 [ l] ∑k=0

N−1

e+ j2πk(m−n−l)/N

∑k=0

N−1

ak= N (a =1)

=1−aN

1−a (a ≠1)a = e+ j2π(m−n−l)/N

9DT Convolution

(1B)

Circular Convolution (2)

Young W. Lim2/5/14

(m−n−l )N

0N ,

1N ,

N−1N ,⋯,

0N +1, 1

N +1 , N−1N +1,⋯,

0N +2, 1

N +2 , N−1N +2,⋯,

⋮ ⋮ ⋮

ej2π(m−n−l)

N e j2π⋅0/N , e j2π⋅1/N , e+ j2π(N−1)/N⋯,∈ ej2π(m−n−l)

N = ej2π ((m−n−l))N

N

((m−n−l))N = 0 ej2π(m−n−l)

N = ej2π ((m−n−l))N

N = 1

∑k=0

N−1

ej2πk(m−n−l)

N = ∑k=0

N−1

ej2πk((m−n−l))N

N = N

((m−n))N = l

10DT Convolution

(1B)

Circular Convolution

Young W. Lim2/5/14

x [0]

x [2]

x [1]x [3]

x [3]

x [1]

x [0]x [2]

x [2]

x [0]

x [3]x [1]

x [1]

x [3]

x [2]x [0]

x [⟨n−0⟩4] x [⟨n−1⟩4] x [⟨n−2⟩4] x [⟨n−3⟩4]

11DT Convolution

(1B)

Circular Convolution

Young W. Lim2/5/14

x [0]

x [2]

x [1]x [3]

x [3]

x [1]

x [0]x [2]

x [2]

x [0]

x [3]x [1]

x [1]

x [3]

x [2]x [0]

x [⟨n−0⟩4] x [⟨n−1⟩4] x [⟨n−2⟩4] x [⟨n−3⟩4]

h[2] h[2] h[2] h[2]

h[0] h[0] h[0] h[0]

h[1] h[1] h[1] h[1]h[3] h[3] h[3] h[3]

12DT Convolution

(1B)

Circular Convolution

Young W. Lim2/5/14

13DT Convolution

(1B)

Octave conv()

Young W. Lim2/5/14

conv (a, b)conv (a, b, shape)

Convolve two vectors a and b.

The length of the output vector : length (a) + length (b) – 1

When a and b are the coefficient vectors of two polynomials, the convolution represents the coefficient vector of the product polynomial.

The optional shape argument may be

shape = "full" Return the full convolution. (default) shape = "same" Return the central part of the convolution with the same size as a.

See also: deconv conv2 convn fftconv

14DT Convolution

(1B)

Octave fftconv()

Young W. Lim2/5/14

fftconv (x, y)fftconv (x, y, n)

Convolve two vectors using the FFT for computation.

c = fftconv (x, y) returns a vector of length equal to length (x) + length (y) - 1.

If x and y are the coefficient vectors of two polynomials, the returned value is the coefficient vector of the product polynomial.

The computation uses the FFT by calling the function fftfilt. If the optional argument n is specified, an N-point FFT is used.

fftfilt (b, x, n)

With two arguments, fftfilt filters x with the FIR filter b using the FFT.

Given the optional third argument, n, fftfilt uses the overlap-add method to filter x with b using an N-point FFT.

If x is a matrix, filter each column of the matrix.

15DT Convolution

(1B)

a

Young W. Lim2/5/14

16DT Convolution

(1B)

a

Young W. Lim2/5/14

17DT Convolution

(1B)

a

Young W. Lim2/5/14

18DT Convolution

(1B)

a

Young W. Lim2/5/14

19DT Convolution

(1B)

a

Young W. Lim2/5/14

20DT Convolution

(1B)

a

Young W. Lim2/5/14

21DT Convolution

(1B)

a

Young W. Lim2/5/14

Young W. Lim2/5/14

22DT Convolution (1B)

References

[1] http://en.wikipedia.org/[2] J.H. McClellan, et al., Signal Processing First, Pearson Prentice Hall, 2003[3] M. J. Roberts, Fundamentals of Signals and Systems[4] S. J. Orfanidis, Introduction to Signal Processing[5] D. G. Manolakis, V. K. Ingle, Applied Digital Signal Processing