41
1 Digital Signal Digital Signal Processing Processing Chapter 2 Discrete Convolution

2.0 Discrete Convolution BEE3213

Embed Size (px)

Citation preview

Page 1: 2.0 Discrete Convolution BEE3213

11

Digital Signal ProcessingDigital Signal Processing

Chapter 2Discrete Convolution

Page 2: 2.0 Discrete Convolution BEE3213

22

ApplicationsApplications

Convolution and related operations are found in many applications of engineering and mathematics.

In electrical engineering, the convolution of one function (the input) with a second function representing the response of a linear time-invariant system to a brief but strong impulse gives the system's output. At any given moment, the output is an accumulated effect of all the prior values of the input function, with the most recent values typically having the most influence (expressed as a multiplicative factor). The impulse response function provides that factor as a function of the elapsed time since each input value occurred.

Page 3: 2.0 Discrete Convolution BEE3213

33

Discrete SignalsDiscrete Signals

Convolution is a central concept in relating the

time & frequency domains. Discrete-time convolution is a method of

finding the zero-state response of relaxed linear

time-invariant (LTI) systems. The system impulse response is h[n]. If the input is δ[n], a unit sample at the origin n

= 0, the system response is h[n].

Page 4: 2.0 Discrete Convolution BEE3213

44

If the input is x[0]δ[n], a scaled impulse at the

origin, the response is x[0]h[n]. If the input is the shifted impulse x[l]δ[n - 1] at n

= 1, the response is x[l]h[n - 1]. The response to the shifted impulse x[k]δ[n - k] at

n = k is x[k]h[n - k]. Since input x[n] is a sequence of samples, it can

be described by a sum of scaled & shifted impulses:

knkxnxk

Page 5: 2.0 Discrete Convolution BEE3213

55

By superposition, the response to x[n] is the sum

of scaled & shifted versions of the impulse

response:

It is called linear convolution. The expression for computing y[n] is called the

convolution sum. The arguments of x & h can be interchanged

without affecting the result.

nhnxknhkxnyk

Page 6: 2.0 Discrete Convolution BEE3213

66

Thus,

nxnhkhknxnyk

Page 7: 2.0 Discrete Convolution BEE3213

77

The procedure for analytical convolution can be implemented if x[n] & h[n] are described by simple analytical expressions. Resort a table of closed-form solutions for finite or infinite series. x[k] & h[n - k] are functions of the summation variable k. The summations frequently involve step functions of the form u[k] & u[n - k].

Analytical Evaluation of Analytical Evaluation of Discrete ConvolutionDiscrete Convolution

Page 8: 2.0 Discrete Convolution BEE3213

88

Since u[k] = 0, k < 0 & u[n - k] = 0, k > n, these can be used as lower & upper limits (k = 0 & k = n).Example 2.1Let x[n] = h[n] = u[n]. Then x[k] = u[k] & h[n - k] = u[n – k]. The lower limit on the convolution sum simplifies to k = 0 (because u[k] = 0, k < 0), the upper limit to k = n (because u[n - k] = 0, k > n), and we get

1110

nrnunknukunhnxnyn

kk

Page 9: 2.0 Discrete Convolution BEE3213

99

Many of discrete convolution properties are based on LTI. If x[n] or h[n] is shifted by no, so is y[n]. Thus, if y[n] = x[n] * h[n], then

x[n - no] * h[n] = x[n] * h[n - no] = y[n - no]

The sum of the samples in x[n], h[n], & y[n] are related by

Convolution PropertiesConvolution Properties

nnn

nhnxny

Page 10: 2.0 Discrete Convolution BEE3213

1010

For causal systems (h[n] = 0, n < 0) & causal signals (x[n] = 0, n < 0), y[n] is also causal. Thus,

Convolution of two left-sided signals is also left-sided. (Same for two right-sided signals). Some other properties:δ[n] * x[n] = x[n]δ[n] * δ[n] = δ[n] Since step response is the running sum of impulse response, the convolution of x[n] with a unit step is the running sum of x[n]:

knxkhknhkxnxnhnhnxnyn

k

n

k

00

k

kxnunx

Page 11: 2.0 Discrete Convolution BEE3213

1111

In practice, we deal with sequences of finite

length, & their convolution may be found by

several methods. The convolution y[n] of two finite-length

sequences x[n] & h[n] is also of finite length &

is subject to the following rules:

I) The starting index of y[n] equals the sum of the

starting indices of x[n] & h[n].

II) The ending index of y[n] equals the sum of the

ending indices of x[n] & h[n].

III) Ly = Lx + Lh - 1.

Page 12: 2.0 Discrete Convolution BEE3213

1212

The convolution y[n] equals the sum of the (shifted) impulse responses due to each of the impulses that make up the input x[n]. To find the convolution, a row of index values is set up beginning with the starting index of the convolution & h[n] & x[n] below it. x[n] is a sequence of weighted shifted impulses. Each element (impulse) of x[n] generates a shifted impulse response (product with h[n]) starting at its index (to indicate the shift).

Sum-by-Column MethodSum-by-Column Method

Page 13: 2.0 Discrete Convolution BEE3213

1313

Summing the response (by columns) gives the

discrete convolution.

None of the sequences is folded.

The starting index for convolution y[n] is found

from the starting indices of x[n] & h[n].

Page 14: 2.0 Discrete Convolution BEE3213

1414

Summary Using the Sum-by-

Column Method

I) Line up x[n] below h[n].

II) Line up with each sample of x[n], the product of

the entire array h[n] with that sample of x[n].

III)Sum the columns of the (successively shifted)

arrays to generate the convolution sequence.

Page 15: 2.0 Discrete Convolution BEE3213

1515

Example 2.2

An FIR filter has an impulse response given by

h[n] = { , 2, 2, 3}. Find its response y[n] to the

input x[n] = { , -1, 3}. Assume both x[n] & h[n]

start at n = 0.

Solution

x[n] = 2δ[n] - δ[n - 1] + 3δ[n - 2] & tabulates the

response to each impulse & the total response as

follows:

1

2

Page 16: 2.0 Discrete Convolution BEE3213

1616

hh[[nn]] == 11 22 22 33

xx[[nn]] == 22 -1-1 33

InputInput ResponseResponse

22δδ[[nn]] 22hh[[nn]] == 22 44 44 66

-- δ δ[[n n - 1]- 1] -- h h[[n n - 1]- 1] == -1-1 -2-2 -2-2 -3-3

33δδ[[nn - 2] - 2] 33hh[[nn - 2] - 2] == 33 66 66 99

Sum=Sum= x x[[nn]] Sum=Sum= y y[[nn]] == 22 33 55 1010 33 99

Page 17: 2.0 Discrete Convolution BEE3213

1717

Ly = Lx + Lh – 1

= 3 + 4 – 1 = 6.

y[n] = { , 3, 5, 10, 3, 9}

y[n] = 2δ[n] + 3δ[n - 1]

+ 5δ[n - 2] + 10δ[n - 3]

+ 3δ[n - 4] + 9δ[n - 5]

2

Page 18: 2.0 Discrete Convolution BEE3213

1818

Convolution sum can be interpreted as:

Fold x[n] & shift x[-n] to line up its last element

with the first element of h[n].

Successively shift x[-n] (to the right) past h[n],

one index at a time, & find the convolution at each

index as the sum of the pointwise products.

This is called the sliding strip method.

Fold, Shift, Fold, Shift, Multiply & Sum ConceptMultiply & Sum Concept

Page 19: 2.0 Discrete Convolution BEE3213

1919

Example 2.3

Find the discrete convolution of h[n] = { , 5, 0,

4} and x[n] = { , 1, 3} by using the sliding strip

method.

Solution

Since both sequences start at n = 0, the folded

sequence is:

x[-k] = {3, 1, }. Using the sliding strip method:

2

4

4

Page 20: 2.0 Discrete Convolution BEE3213

2020

y[0] = sum of products = 8

y[1] = sum of products = 2 + 20 = 22

22 55 00 44

33 11 44 SlideSlide

88

22 55 00 44

33 11 44

22 2020

Page 21: 2.0 Discrete Convolution BEE3213

2121

y[3] = sum of products = 15 + 0 + 16 = 31

y[4] = sum of products = 0 + 4 = 4

22 55 00 44

33 11 44

1515 00 1616

22 55 00 44

33 11 44

00 44

Page 22: 2.0 Discrete Convolution BEE3213

2222

y[5] = sum of products = 12

The discrete convolution is given by

y[n] = { , 22,11,31,4,12}.

22 55 00 44

33 11 44

1212

8

Page 23: 2.0 Discrete Convolution BEE3213

2323

The discrete convolution of two finite-length

sequences x[n] & h[n] is equivalent to

multiplication of two polynomials whose

coefficients are described by x[n] & h[n]. Example 2.4Find the discrete convolution of h[n] = { , 5, 0,

4} & x[n] = { , 1, 3} by using the polynomials

multiplication method.

The Polynomials The Polynomials Multiplication Concept Multiplication Concept

2

4

Page 24: 2.0 Discrete Convolution BEE3213

2424

Solutionh[m] = 2m3 + 5m2 + 0m + 4 = 2m3 + 5m2 + 4x[m] = 4m2 + 1m + 3 = 4m2 + m + 3y[m] = h[m] * x[m] = (2m3 + 5m2 + 4) * ( 4m2 + m + 3) y[m] = 8m5 + 2m4 + 6m3 + 20m4 + 5m3 + 15m2 + 16m2 + 4m + 12 y[m] = 8m5 + 22m4 + 11m3 + 31m2 + 4m + 12

Hence, y[n] = { , 22, 11, 31, 4, 12}

8

Page 25: 2.0 Discrete Convolution BEE3213

2525

If zeroes are inserted between adjacent samples of each signal to be convolved, their convolution corresponds to the original convolution sequence with zeros inserted between its adjacent samples.Example 2.5Find the discrete convolution of h[n] = { , 5, 0, 4} and x[n] = { , 1, 3} by using the zero insertion method.

Zero Insertion Concept Zero Insertion Concept

2

4

Page 26: 2.0 Discrete Convolution BEE3213

2626

h[n] = { , 0, 5, 0, 0, 0, 4}

x[n] = { , 0, 1, 0, 3}h[m] = 2m6 + 5m4 + 4 x[m] = 4m4 + m2 + 3y[m] = h[m] * x[m] = (2m6 + 5m4 + 4) * (4m4 + m2 + 3) y[m] = 8m10 + 22m8 + 11m6 + 31m4 + 4m2 + 12

Hence, y[n] = { , 0, 22, 0, 11, 0, 31, 0, 4, 0, 12}

2

4

8

Page 27: 2.0 Discrete Convolution BEE3213

2727

PracticePractice

Page 28: 2.0 Discrete Convolution BEE3213

2828

Page 29: 2.0 Discrete Convolution BEE3213

2929

The regular convolution of two signals, both of which are periodic, does not exist. For this reason, periodic convolution is measured by using averages. If both xp[n] and hp[n] are periodic with identical

period N, their periodic convolution generates a convolution result yp[n] that is also periodic with

the same period N. The periodic convolution or circular convolution yp[n] of xp[n] and hp[n] is denoted by:

yp[n] = xp[n] hp[n]

Periodic ConvolutionPeriodic Convolution

Page 30: 2.0 Discrete Convolution BEE3213

3030

Over one period (n=0,1, ...,N - 1), it is defined by:

An averaging factor of 1/N is sometimes included

with the summation. Periodic convolution can be implemented using

wraparound.

nxnhnhnxny ppppp

knxkhknhkxny p

N

kpp

N

kpp

1

0

1

0

Page 31: 2.0 Discrete Convolution BEE3213

3131

The linear convolution of one period of xp[n] and

hp[n] will have (2N - 1) samples.

Its length is extended to 2N, slice it in two halves

(of length N each), line up the second half with

the first & add the two halves to get the periodic

convolution. Example 2.6

Find the periodic convolution of xp[n] = { , 0, 1,

1} and hp[n] = { , 2, 3, 1} with the period of N

= 4.

1

1

Page 32: 2.0 Discrete Convolution BEE3213

3232

y[n] = { , 2, 4, 4, 5, 4, 1}

1

nn 00 11 22 33 44 55 66

hhpp[[nn]] 11 22 33 11

xxpp[[nn]] 11 00 11 11

11 22 33 11

00 00 00 00

11 22 33 11

11 22 33 11

yy[[nn]] 11 22 44 44 55 44 11

Page 33: 2.0 Discrete Convolution BEE3213

3333

yp[n] = { , 6, 5, 4}

6

nn 00 11 22 33

First half of First half of yy[[nn]] 11 22 44 44

Wrap around half of Wrap around half of yy[[nn]] 55 44 11 00

Periodic convolution Periodic convolution yypp[[nn]] 66 66 55 44

Page 34: 2.0 Discrete Convolution BEE3213

3434

To find the periodic convolution, we shift the folded signal xp[-n] past hp[n], one index at a time,

& find the convolution at each index as the sum of the pointwise product of their samples but only over a one-period window (0, N - 1). Values of xp[-n] and hp[n] outside the range (0, N -

1) are generated by periodic extension. One way to visualize the process is to line up x[k] clockwise around a circle & h[k] counterclockwise (folded).

Periodic Convolution - Periodic Convolution - Cyclic Method Cyclic Method

Page 35: 2.0 Discrete Convolution BEE3213

3535

Example 2.7

Find the periodic convolution of xp[n] = { ,

2, 3} and hp[n] = { , 0, 2} with the period of N = 3

using the cyclic method.

1

1

Page 36: 2.0 Discrete Convolution BEE3213

3636

Correlation is a measure of similarity between two signals and is found using a process similar to convolution. Correlation is the convolution of one signal with a folded version of the other.The discrete cross-correlation (denoted ) of x[n] and h[n] is defined by:

Discrete CorrelationDiscrete Correlation

khnkxnkhkxnhnxnrkk

xh

kxnkhnkxkhnxnhnrkk

hx

Page 37: 2.0 Discrete Convolution BEE3213

3737

To find rxh[n], the last element of h[n] is lined up

with the first element of x[n] & start shifting h[n] past x[n]. The pointwise product of the overlapping values are summed up to generate the correlation. This is equivalent to performing the convolution of x[n] & the folded signal h[-n]. The starting index of the correlation equals the sum of the starting indices of x[n] and h[-n]. Similarly, rhx[n] equals the convolution of x[-n] &

h[n], & its starting index equals the sum of the starting indices of x[-n] & h[n].

Page 38: 2.0 Discrete Convolution BEE3213

3838

However, rxh[n] does not equal to rhx[n].

The two are folded versions of each other &

related by rxh[n] = rhx[-n].

Some equations need to be remembered:

Correlation length: Nx + Nh - 1

Correlation sum:

nhnxnhnxnrxh

nxnhnxnhnrhx

nhnxnr

Page 39: 2.0 Discrete Convolution BEE3213

3939

The correlation rxx[n] of a signal x[n] with itself is

called the autocorrelation.

It is an even symmetric function (rxx[n] = rxx[-n])

with a maximum at n = 0 and satisfies the

inequality .Correlation is an effective method of detecting

signals buried in noise. Noise is essentially uncorrelated with the signal.

AutocorrelationAutocorrelation

Page 40: 2.0 Discrete Convolution BEE3213

4040

It means that if we correlate a noisy signal with

itself, the correlation will be due only to the signal

(if present) and will exhibit a sharp peak at n = 0.The autocorrelation is always even symmetric

with a maximum at the origin. Some equations need to be remembered:

nxnxnxnxnrxx

nrnr xxxx

0xxxx rnr

Page 41: 2.0 Discrete Convolution BEE3213

4141

Example 2.8

Given x[n] = auu[n], |a| < 1. Find rxx[n] for .

SolutionSince x[k - n] = ak-nu[k - n] starts at k = n, then

Since autocorrelation is an even symmetric

function, we have

0n

nk m m

nmnmnmnkk

kxx a

aaaaaaankxkxnr0 0

22

1

1

21 a

anr

n

xx