Docsity

Convolution - Digital Signal Processing - Lab Manual, Study notes of Computer Fundamentals

Toggle sidebar
bg1
Convolution
INTRODUCTION
This lab looks at continuous-time (CT) linear time-invariant (LTI) systems, including numerical
approximation of the convolution integral, graphical interpretation of convolution, and
simulation of systems. Perform the following procedures step by step. Make sure that you
understand all commands and procedures used in each section.
SECTION A: THE conv FUNCTION
This section covers the use of the conv function. The function of conv(a,b) computes the
summation
∑
=
−+=
N
k
knbkanc
1
1)()()(
where a and b are the input sequences. c is the output sequence, and N is the length of sequence
a. If the length of sequence b is M, then sequence c will contain N+M- 1 elements. The default
value for undefined elements is zero. Observe that all indices start from 1, e.g., c(1) represents
the first element of the sequence c. You should notice that conv function does not return the
indices of the output vector, so it is up to you to keep track of them in order to plot the output
with the correct time indices. (You may also need to do this for input sequences a and b, by
creating additional index vectors.)
Step 1:
Let x1(t) and x2(t) be two rectangular pulse signals given by:
xl(t) = u(t-5) - u(t-45); x2(t) = u(t-20) - u(t-100).
Note that CT signals may be approximated by their samples. Use following commands to create
two sequences xl and x2:
»tx=(0:255);
»x1=t x>=5 & tx<45 ;
»x2 =tx>=20 & tx<100;
The variable tx is a discrete time index instead of a continuous one.
Docsity.com
pf3
pf4

Partial preview of the text

Download Convolution - Digital Signal Processing - Lab Manual and more Study notes Computer Fundamentals in PDF only on Docsity!

Convolution

INTRODUCTION

This lab looks at continuous-time (CT) linear time-invariant (LTI) systems, including numerical approximation of the convolution integral, graphical interpretation of convolution, and simulation of systems. Perform the following procedures step by step. Make sure that you understand all commands and procedures used in each section.

SECTION A: THE conv FUNCTION

This section covers the use of the conv function. The function of conv( a,b ) computes the summation

=

N

k

cn ak bn k 1

where a and b are the input sequences. c is the output sequence, and N is the length of sequence a. If the length of sequence b is M, then sequence c will contain N+M- 1 elements. The default value for undefined elements is zero. Observe that all indices start from 1, e.g., c(1) represents the first element of the sequence c. You should notice that conv function does not return the indices of the output vector, so it is up to you to keep track of them in order to plot the output with the correct time indices. (You may also need to do this for input sequences a and b , by creating additional index vectors.)

Step 1: Let x1(t) and x2(t) be two rectangular pulse signals given by: xl(t) = u(t-5) - u(t-45); x2(t) = u(t-20) - u(t-100). Note that CT signals may be approximated by their samples. Use following commands to create two sequences xl and x2:

»tx=(0:255); »x1=t x>=5 & tx<45 ; »x2 =tx>=20 & t x<100;

The variable tx is a discrete time index instead of a continuous one.

Step 2: Define an impulse response hl(t) to characterize an LTI system:

t

t

t

t

t

t

h ( t )

The followings are the commands to generate the sequence h1:

_»th=(0:255); »h1= (th>5 & th<=35).(th-5)/30+ (th>35&th<65).(65-th)/30; »plot(th,h1); »axis([0 255 -0.2 max(h1)+0.2]); »xlabel(’t’),ylabel(’h1’); »title(‘Transfer Function h1’);_**

Step 3:

Compute y1 = conv(x1,h1). How many nonzero samples are there in y1?

Example: If a =[l 2 3]. b = [4 5 6], then conv(a,b) will give

ans = 4 13 28 27 18

The following commands convolve the signal xl with the impulse response h1 :

»y1=conv(x1,h1); »ty=(0:length(tx)+length(th)-2); »plot(ty,y1); »axis([0 256 -2 max(y1)+2]); »xlabel(‘t’),ylabel(‘y1’ ), title(‘Convolution of x1 and h1’);

Question 1: Compute y2= conv (x2,h 1). Generate a new sequence x = xl +2x2. Compute* y=conv(x,h1). Compute y3=y1+2 y2. Plot y1, y2, y3 and y on the same graph (use different types of symbols for the different functions).*

Question 2:

Use the MATLAB process in Section B to convolve the following functions.

1.

Question 3:

Use the definition of convolution to compare the graphs in Question 2.

0 1 t

h(t) 1

0 1 t

x(t) 1

0 4 t

x(t) 3

h ( t )= 5 e −^2 tu ( t ) 5

t