0% found this document useful (0 votes)
10 views

Lab2

The document outlines a lab focused on the convolution of discrete-time sequences, aiming to teach students about even and odd component decomposition of signals and the convolution process using LTI systems. It includes basic signal operations, methods for convolution, and practical tasks to implement in MATLAB. The lab tasks involve writing functions for signal decomposition, performing convolution, and analyzing the limitations of the built-in 'conv' command.

Uploaded by

badarqureshi1194
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Lab2

The document outlines a lab focused on the convolution of discrete-time sequences, aiming to teach students about even and odd component decomposition of signals and the convolution process using LTI systems. It includes basic signal operations, methods for convolution, and practical tasks to implement in MATLAB. The lab tasks involve writing functions for signal decomposition, performing convolution, and analyzing the limitations of the built-in 'conv' command.

Uploaded by

badarqureshi1194
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Digital Signal Processing Lab

508518

Name

Registration Number

Batch & Section

Instructor’s Name
Lab # 02 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 familiarized 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.

Basic Signal Operations:


Before performing convolution, let’s revise the basic operations on continuous and discrete time
signals.

1. Time Reversal y(t) = x(-t) / y[n]=x[-n]


2. Time Shifting y(t) = x(t-td) / y[n]=x[n-k]
3. Amplitude Scaling y(t) = Bx(t) / y[n]=Bx[n]
4. Addition y(t) = x1(t) + x2(t) / y[n]=x1[n]+x2[n]
5. Multiplication y(t) = x1(t)x2(t) / y[n]=x1[n]x2[n]

6. Decomposition of signals:
Let’s have a look at how to decompose a signal into its even and odd components.

Even and odd synthesis

 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

x(n) = xe (n) + xo (n)


xe (n) = 1 [ x(n) + x(−n)], xo (n) = 1 [ x(n) − x(−n)]
2 2
• Try writing a function that decomposes a given signal into its even and odd components.
You can think like the steps given below.
▪ Input a signal
▪ Flip the signal
▪ Calculate its length
▪ Calculating even and odd parts.
7. Convolution of signals:

• Recall the “conv” command you used in your signals and systems course. Try performing
convolution using conv command.
>> y = conv(x,h)

• You will see there is a limitation in conv command. Can you find a solution to it?

Convolution:
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:

• For any given n, one point convolution is evaluated as

– Step 1: time reversal of either signal (e.g., x(k)→x(-k) ) or h(k)→h(-k)

– Step 2: shift h(-k) by n samples to obtain h(n-k)

– Step 3: multiply x(k) and h(n-k) for each k and then take the summation over k

Note

• You need to change variable n to get the whole sequence

Example:

x(n)=[1 2 3 4] and h(n)=[1 –1]

Step 1: Time reversal

h(k)=[1 -1] h(n-k)=[-1 1]


Step 2: Time shift

Step 3: Multiply and Add


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)= ∑k (∑k ak δ(n-k)) h(n-k)

y(n)= ∑ (a0 δ(n)+ a1 δ(n-1)+ a2 δ(n-2)+ a3 δ(n-3)+ …….. ) h(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:

Consider the same example we solved in first method of convolution as above.

x(n) = [1 2 3 4], h(n)= [1 -1]

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:

Final result is the summation of y0, y1,y2, y3.

y(n)
1 1 1 1

0 1 2 3 4 n

-4

Lab Tasks: [Q Marks-10, CLO-1, PLO-4]

Task 1:

Write a function (in MATLAB) for decomposition of discrete time sequence to distinguish its
even and odd components.
Task 2:

Write a function convolution in MATLAB that performs 1D linear convolution by the steps
mentioned above using any method. You can process the sequence to distinguish the convolution
results of your function and the MATLAB built-in function “conv”.

Task 3: (Home Task)

You should have noticed that “conv” command calculates convolution assuming both input
sequences are starting from origin (i-e no values on –ve n-axis). This is not always the case; we do
have sequences which have values for n<0. Write a function conv_m to describe and analyze the
“conv” command that would remove this limitation in the built-in function “conv”.

Task 4: (Home Task)

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”:

• x[n] = [1 2 1], n=[0 1 2] h[n] = [1 1 1], n= [0 1 2]


• x[n] = [-1 4 -3 -2 1 0 2], n=[-2:4] h[n] = [1 1 1], n= [-1 0 1]

You might also like