Signals, Spectra and Signal Processing Name: Date: Section: Rating: Exercise #04 The Convolution Sum

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 8

Signals, Spectra and Signal Processing

Name: Date:
Section: Rating:
Exercise #04
The Convolution Sum

Introduction:
A discrete-time system can be characterized by its impulse response in time-domain. The impulse
response of the system is its response to a unit sample sequence input. Upon knowing the impulse
response of the system, h(n), its output y(n) to any arbitrary input x(n) can be evaluated using the
convolution of x(n) and h(n).This exercise is intended to introduce the concept of convolution operation.
MATLAB is used to obtain the convolution of two finite length sequences. To obtain the convolution sum
of infinitely long sequences, an approximation can be made.

Part 1 – Convolution of finite length sequences


The convolution algorithm is defined as

y  n   x k h n  k 
k  

From this, it shows that the algorithm consists of four steps, namely
 Folding – folding of h(k) about the origin
 Shifting – shifting of h(-k) by n from -∞ to +∞.
 Multiplication – multiplying h(n-k) to x(k) for a particular n.
 Addition – adding the product sequence of x(k) and h(n-k) for a particular n to obtain the output at
time = n.

If the impulse response h(n) and input x(n) are both finite sequences, then its convolution sum can be
computed numerically with the aid of a table. For example, to compute the convolution sum of the
sequences
   
x  n   1 2 1 3 and h n     1 2 1
    

we accomplish the following table:


1 2 -1 3

1
1 1 2 -1 3
2 2 4 -2 6
-1 -1 -2 1 -3

and obtain the diagonal sums. Therefore, output y(n) will be


 
y  n   1 0 6 3 5 3 .
  

where the reference is the sum of the terms where the intersection of the references of x(n) and h(n) is
found.
1. With the aid of a table, find the convolution sum of the following sequences:
   
a. x n  1 2 4 , h n    1 1 1 1 1
   

X(N) 1 2 4
H(N)
1 1 2 4
1 1 2 4
1 1 2 4
1 1 2 4
1 1 2 4
y(n)={1,3,7,7,7,6,4}

, h n   x  n
 
b. x n  1 2  1
 

X(N) 1 2 -1
H(N)
1 1 2 -1
2 2 4 -2
-1 -1 -2 1
y(n)={1,4,2,-4,1}

 
 
c. x  n   0 1  2 3  4 , h n    1 1 1 1
  2 2 2
 

X(N) 0 1 -2 3 -4
H(N)
½ 0 ½ -1 3/2 -2
½ 0 ½ -1 3/2 -2
1 0 1 -2 3 -4
½ 0 ½ -1 3/2 -2
y(n)={0,1/2,-1/2,3/2,-2,0,-5/2,-2}

   
d. x  n   1 1 0 1 1 , h n   1  2 3 4
    

X(N) 1 1 0 1 1
H(N)
1 1 1 0 1 1
-2 -2 -2 0 -2 -2

2
-3 -3 -3 0 -3 -3
4 4 4 0 4 4
y(n)={1,-1,-5,2,3,-5,1,4}

, h n  x  n
 
e. x  n   1 2 0 2 1
  

X(N) 1 2 0 2 1
H(N)
1 1 2 0 2 1
2 2 4 0 4 2
0 0 0 0 0 0
2 2 4 0 4 2
1 1 2 0 2 1
y(n)={1,4,4,4,10,4,4,4,1}

2. Comment on the relationships of the lengths of x(n) and h(n) to the length of y(n).
The length of y(n) is equal to the sum of lengths of x(n) and h(n) minus 1.
Y(N)length = [X(N)length + h(N) length] – 1

In MATLAB to evaluate the convolution sum of two finite sequences, the command conv(x,h) is used,
where x and h are row matrices of the input signal and the impulse response respectively.
The length of y(n) varies depending on the length x(n) and h(n) that can be determined by the equation:
l = (no. of x(n) + no. of y(n)) - 1.

3. Using MATLAB, obtain the convolution sum of the sequences given in Question 1. Write the
MATLAB commands you used on the space provided below. Plot the output sequences.

1 A.

clc;
clear all;
close all;
x = [1 2 4];
nx = [0 1 2];
h = [1 1 1 1 1];
nh = [0 1 2 3
4];
y= conv(x,h);
ny=0:length(y)-
1;
figure(1)
stem(ny,y)

3
1 B.
clc;
clear all;
close all;
x = [1 2 -1];
nx = [0 1 2];
h = [1 2 -1];
nh = [0 1 2];
y= conv(x,h);
ny=0:length(y)-1;
figure(1)
stem(ny,y)

1 C.
clc;
clear all;
close all;
x = [0 1 -2 3 -4];
nx = [0 1 2 3 4];
h = [1/2 1/2 1 1/2];
nh = [0 1 2 3];
y= conv(x,h);
ny=0:length(y)-1;
figure(1)
stem(ny,y)

4
1 D.
clc;
clear all;
close all;
x = [1 1 0 1 1];
nx = [-2 -1 0 1 2];
h = [1 -2 -3 4];
nh = [-3 -2 -1 0];
y= conv(x,h);
ny=0:length(y)-1;
figure(1)
stem(ny-5,y)

1 E.
clc;
clear all;
close all;
x = [1 2 0 2 1];
nx = [-1 -2 0 -1 -2];
h = [1 2 0 2 1];
nh = [-1 -2 0 1 2];
y= conv(x,h);
ny=0:length(y)-1;
figure(1)
stem(ny-4,y)

5
Part 2 – Convolution of infinitely length sequences
Unfortunately, MATLAB cannot be used to completely compute the convolution sum of infinitely length
sequences. However, it can be approximated by assigning values to n and computing the convolution sum
for a particular range of n.
4. Compute the convolution sum of the sequences defined by
and

and obtain the first ten terms of the output sequence.

5. Using MATLAB, define the sequences given in problem #4 for 0  n  10 , then compute their
convolution sum using the conv function. What is the first ten terms of the output sequence? This
should be the same as what you have obtained before.

6
Observation:

Conclusion:

Abigail F. Sy
ECE 401-CPE41S1
CONCLUSION

In this activity we were able to learn how to generate the convolution of two finite length discrete-time
signal using MATLAB. I therefore I conclude that the objectives were achieved during the activity as we
were able to Generate the convolution of two finite length discrete-time signal using MATLAB and was
able to Plot the convolution sum using MATLAB. Although there are some difficulties I believed that the
outcomes are satisfactory.

7
8

You might also like