You are on page 1of 11

Digital Signal Processing

Lecture 5

Dr. Muayad

3rd year
Convolution and correlation
5.1 Convolution:
Convolution is a mathematical way of combining two signals to form
a third signal. It is the single most important technique in Digital Signal
Processing. Using the strategy of impulse decomposition, systems are
described by a signal called the impulse response. Convolution is important
because it relates the three signals of interest: the input signal, the output
signal, and the impulse response.
Convolution is a method which described the relation between the
input to a linear time invariant system x(n), and the output y(n). The
convolution formula used to determine the output of an LTI system to any
given arbitrary input signal

y ( n)   x ( k ) h( n  k )
k  
or

y ( n)   h( k ) x ( n  k )
k  

In most practical cases there are many more finite sample values in x(n) and
probably also more in h(n) then superpose many more individual responses
to find the output signal.
Note: the length of convolution signal is N1+N2-1
Where N1=length of the first signal, N2=length of the other signal
The convolution method may also be performed graphically as described by
the following example
Example (5-1): The impulse response of a linear time invariant system is
h(n)=[1,2,2]. Determine the response of the system to input signal

x(n)= [2,-3,1] using convolution sum

Solution: The graphical representation of a convolution is illustrated in


figure (5.1)

Figure (5.1) Graphical computation of a convolution

Another way to visualize the convolution sum is to draw the signals x[k] and
h[n- k] as functions of k (for a fixed n), multiply them to form the signal
g[k], and then sum all values of g[k].
Example (5-2): Let us compute y[0] and y[1] for the input signal and
impulse response of an LTI system shown in Figure (5.2)

Figure (5.2) Input signal with an impulse response.


Solution:-
Case n = 0:
Step 1: Sketch x[k] and h[0-k] = h[-k] as in Figure (5.3)

Figure (5.3) Impulse response flipped around the vertical axis


Step 2: Multiply x[k] and h[-k] to get g[k] shown in Figure (5.4)

Figure (5.4) Product of flipped impulse response with input signal for n = 0

Step 3: Sum all values of g[k] from k=∞ to -∞ to get y[0],y[0]=3


Case n = 1:
Step 1: Sketch x[k] and h[1-k]=h[-(k-1)]( (i.e., the signal h[-k] delayed by
1) as in Figure (5.5)

Figure (5.5) Time-reversed and shifted impulse response for n = 1


Step 2: Multiply x[k] and h[1- k] to get g[k] shown in Figure (5.6)

Figure (5.6) Product of flipped and shifted impulse response with input signal for n = 1.
Step 3: Sum all values of g[k] from k=∞ to -∞ to get y[0],y[1]=5

5.2 Convolution Properties


 Commutative Property
The commutative property states that the order in which two sequences are
convolved is not important. Mathematically, the commutative property is

 Associative Property
The convolution operator satisfies the associative property, which is

the associative property states that if two systems with unit sample responses
hl(n) and h2(n) are connected in cascade as shown in Figure(5-7-b) an
equivalent system is one that has a unit sample response equal to the
convolution of hl (n) and h2(n):

 Distributive Property
The distributive property of the convolution operator states that

This property asserts that if two systems with unit sample responses hl(n)
and h2(n) are connected in parallel, as illustrated in Figure(5-7-c), an
equivalent system is one that has a unit sample response equal to the sum of
h1 (n) and h2(n):
Figure (5-7) The interpretation of convolution properties

Example ( 5-2): - Two digital LTI processor with difference equation shown
in figure (5.8), find the causal overall impulse response over the range 0 ≤
𝑛 ≤ 5 and sketch h(n) over this range.

Subsys1
𝑦(𝑛) = 𝑥(𝑛) + 2𝑥(𝑛 − 1) + 3𝑥(𝑛 − 2)
y(n)
x(n) +

Subsys2
𝑦(𝑛) = 0.8𝑦(𝑛 − 1) + 𝑥(𝑛)

Figure (5.8) LTI system of example (5-2)

Solution: - The overall impulse response is


ℎ(𝑛) = ℎ1 (𝑛) + ℎ2 (𝑛)
The impulse response of the subsys1 is ℎ1 (𝑛) = 𝛿(𝑛) + 2𝛿(𝑛 − 1) +
3𝛿(𝑛 − 2)
While he impulse response of the subsys2 is ℎ2 (𝑛) = 0.8ℎ(𝑛 − 1) + 𝛿(𝑛)

impulse response of subsys1


3

2.5

2
h(n)

1.5

0.5

0
0 1 2 3 4 5
n

Impulse response of the subsys2


1

0.9

0.8

0.7

0.6
h(n)

0.5

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n

+
The overall impulse response
4

3.5

2.5
h(n)

1.5

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n
Figure (5.9) The overall impulse response of example (5.2)
5.3 CORRELATION OF DISCRETE-T1ME SIGNALS
A mathematical operation that closely resembles convolution is
correlation. our objective in computing the correlation between the two
signals is to measure the degree to which the two signals are similar and thus
to extract some information that depends to a large extent on the application.
Correlation of signals is often encountered in radar, sonar, Digital
communications, geology and other areas in science and engineering.
There are two types of correlation autocorrelation (when the two
signals are identical) and cross correlation (the correlation done between two
signals that are different).
The cross correlation between two signal x(n), y(n) is defined as
𝑟𝑥𝑦 (𝑙) = ∑∞
𝑛=−∞ 𝑥(𝑛)𝑦(𝑛 − 𝑙) 𝑙 = 0, ∓1, ∓2, … . . ∓∞

Or
𝑟𝑦𝑥 (𝑙) = ∑∞
𝑛=−∞ 𝑦(𝑛)𝑥(𝑛 − 𝑙)

Where r denote the correlation, xy denote the correlation between the


sequence x(n),y(n)
Note that 𝑟𝑥𝑦 (𝑙) = 𝑟𝑦𝑥 (−𝑙)
The auto correlation is defined as
𝑟𝑥𝑥 (𝑙) = ∑∞
𝑛=−∞ 𝑥(𝑛)𝑥(𝑛 − 𝑙) 𝑙 = 0, ∓1, ∓2, … . . ∓∞

The auto correlation function is an even function. Consequently, it suffices


to compute 𝑟𝑥𝑥 (𝑙) 𝑓𝑜𝑟 𝑙 ≥ 0 this is denoted as (𝑟𝑥𝑥 (𝑙) = 𝑟𝑥𝑥 (−𝑙) )
Example (5-3): Determine the cross correlation sequence between the
sequences x(n)=[2,1,1], y(n)=[2,2,2]
Solution:-
The cross correlation sequence
𝑟𝑥𝑦 (𝑙) = ∑∞
𝑛=−∞ 𝑥(𝑛)𝑦(𝑛 − 𝑙) 𝑙 = 0, ∓1, ∓2, … . . ∓∞
∞ ∞

𝑟𝑥𝑦 (0) = ∑ 𝑥(𝑛)𝑦(𝑛) = ∑ {… .0,0,0,4,2,0,0. . } = 6


𝑛=−∞ 𝑛=−∞
∞ ∞

𝑟𝑥𝑦 (1) = ∑ 𝑥(𝑛)𝑦(𝑛 − 1) = ∑ {… .0,0,0,4,2,2,0,0. . } = 8


𝑛=−∞ 𝑛=−∞

𝑟𝑥𝑦 (2) = 4 ,
𝑟𝑥𝑦 (−2) = 0
𝑟𝑥𝑦 (−1) = 4
𝑟𝑥𝑦 (3) = 2

The cross corelation sequance


8

5
Rxy

0
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4
n
Homework:
1. Calculate the period for the following sinusoidal sequences
a. 𝑥(𝑛) = 3sin(0.05𝜋𝑛)
b. 𝑥(𝑛) = 2 sin(0.05𝜋𝑛) + 3sin(0.12𝜋𝑛)
2. Given 𝑥1 (𝑛) = 𝑢(𝑛) − 𝑢(𝑛 − 5) , 𝑥2 (𝑛) = 2[𝑢(𝑛) − 𝑢(𝑛 − 3)]
i. Plot x1(n), x2(n)
ii. Calculate and plot y(n), the convolution of x1(n) and
x2(n) for all n
3. Given the following linear constant coefficient difference equation
𝑦(𝑛) + 2𝑦(𝑛 − 1) + 𝑦(𝑛 − 2) = 𝑥(𝑥) with 𝑦(𝑛) = 0 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 < 0
a. Plot 3 samples of the unit impulse response
b. Calculate and plot y(n) for x(n)=u(n)
c. Calculate and plot y(n) for x(n)=u(n)-u(n-2)
4. Find the auto correlation of x(n) in example 5-3

You might also like