Lab 1
Lab 1
Lab 1
Name
Registration Number
Instructor’s Name
Lab # 01 Convolution of Discrete-Time Sequences
Objective:
By the end of this lab, students will be able to understand even and odd component
decomposition of signal. Also, they will be familiarize to get output from LTI systems by
convolving input x(n) with impulse response h(n). This will add to their understanding of LTI
system and its operation.
PRE-LAB
Before performing convolution, you should be familiar with the basic operations on continuous
time signals.
Lets have a look at how to decompose a signal into its even and odd components
if xe (n) xe (n)
if xo (n) xo (n)
then xe (n) is called even( symmetric)
then xo (n) is called odd (antisymmetric)
Any arbitrary real-valued sequence x(n) can be decomposed into its even and odd component
You will see there is a limitation in conv command. Can you find a solution to it?
IN-LAB:
There are two widely used methods to compute convolution. We will discuss both methods before
performing Lab tasks.
Method 1:
Convolution as sum of shifted and scaled impulse response:
– Step 3: multiply x(k) and h(n-k) for each k and then take the summation over k
Note
Example:
Final Result:
x(n)
Method 2:
Convolution as sum of shifted and scaled unit impulses.
Y(n) = ∑k x(n)h(n-k)
x(n) = ∑k ak δ(n-k)
y(n)= ∑ a0 δ(n) h(n)+ ∑a1 δ(n-1) h(n-1)+ ∑ a2 δ(n-2) h(n-2)+ ∑a3 δ(n-3) h(n-3)+ ……..
Example:
y(n)= ∑ (a0 δ(n) h(n)+ a1 δ(n-1) h(n-1)+ a2 δ(n-2) h(n-2)+ a3 δ(n-3) h(n-3)
δ(n) h(n) y0
1 1 1
X =
0 n 0 1 n 0 1 n
-1 -1
δ(n-1) h(n-1) y1
2 1 2
1 n X 1 2 n = 1 2 n
-1 -2
δ(n-2) X h(n-2) = Y2
3 1 3
2 n 2 3 n 2 3 n
-1 -3
δ(n-3) h(n-3) Y3
4 1 4
X =
3 n 3 4 n 3 4 n
-1 -4
Final Result:
y(n)
1 1 1 1
0 1 2 3 4 n
-4
Task 1:
Write a Matlab code to decompose a sequence to describe its even and odd components. Take
help from Pre-Lab work.
Task 2:
Analyze the function convolution in MATLAB that performs 1D linear convolution by the steps
mentioned above. You can process the sequence using any method.
Task 3:
You should have noticed that ‘conv’ command calculates convolution assuming both input
sequences are starting from origin (i-e no values on –ve t-axis). This is not always the case, we do
have sequences which have values for t<0. Write a code conv_m to describe and analyze the
‘conv’ command that would remove this limitation in the code conv.
Task 4:
Analyze the following sequences to convolve them using MATLAB Function “conv” and your
function “conv_m” and plot the input, impulse response and output in one figure using “subplot”: