0% found this document useful (0 votes)
14 views20 pages

Lab 04 DSIP

The document provides an overview of convolution operations on discrete time signals, detailing the mathematical process and its application in signal processing. It includes examples of convolution between various sequences, demonstrating how to compute and plot the results. Additionally, it outlines lab tasks for further practice in convolution operations.

Uploaded by

Afeera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

Lab 04 DSIP

The document provides an overview of convolution operations on discrete time signals, detailing the mathematical process and its application in signal processing. It includes examples of convolution between various sequences, demonstrating how to compute and plot the results. Additionally, it outlines lab tasks for further practice in convolution operations.

Uploaded by

Afeera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Lab#04

To perform Convolution operation on Discrete


time (DT) signals
Convolution
Convolution is a basic mathematical operation that several image
processing operators use. Convolution is a method of
multiplying two arrays of integers, often of different sizes
but of the same dimensionality, to produce a third array of
the same dimensionality.
Convolution in discrete signals

• In signal processing, multidimensional discrete convolution


refers to the mathematical operation between two functions
f and g on an n-dimensional lattice that produces a third
function, also of n-dimensions.
Example 12

1 10

•Plot x sequence 6

•x = [3,11,7,0,-1,4,2];
4
•stem(x)
2

-2
1 2 3 4 5 6 7
3

0
•Plot h sequence
•h = [2, 3, 0, -5, 2, 1]; -1

•stem(h)
-2

-3

-4

-5
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
Example: 1 given the following two
sequences: x(n) = [3,11,7, 0, -1,4,2], h(n) = 60

[2,3,0, -5,2,1]
determine the convolution y(n) = x(n) * h(n). 40

20

x = [3, 11, 7, 0, -1,4,2];


h = [2, 3, 0, -5, 2, 1]; 0

y = conv(x,h)
y=
-20

-40
6 31 47 6 -51 -5 41
18 -22 -3 8 2 -60
0 2 4 6 8 10 12
Example 4

02 3.5

2.5
Plot x[n]=[1 2 3 4] with -1≤n≤2
x = [1 2 3 4]; 2

Lx=length(x); 1.5

nx=0:Lx-1; 1
figure, stem(nx-1,x),
grid on 0.5

0
-1 -0.5 0 0.5 1 1.5 2
Example 4

03 3.5

2.5
For example, given the following two
sequences: 2

x(n) = [1 2 3 4], -1n2; h(n) = [5 6 4 9 2], 1.5


-2n2
  1

determine the convolution y(n) = x(n) * 0.5


h(n).
x = [1 2 3 4]; 0
-1 -0.5 0 0.5 1 1.5 2
Lx=length(x);
nx=0:Lx-1;
figure, stem(nx-1,x), grid on
9

h = [5 6 4 9 2]; 5

Lh=length(h); 4
nh=0:Lh-1;
3
figure, stem(nh-2,h),
grid on 2

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
60

50

40

y = conv(x,h);
Ly=length(y); 30

ny=0:Ly-1;
20
figure, stem(ny-4,y),
grid on 10

0
-4 -3 -2 -1 0 1 2 3
h[n]

Example 04
1

0.9

0.8

0.7

Convolve x[n]= u[n] ;h[n]=an u[n] for a <1 0.6

0.5
clear all
close all 0.4
n=-10:1:100; 0.3
x=1*(n>=0);
stem(n,x);grid on 0.2

a=0.9; 0.1
h=(a.^n).*x;
0
figure,stem(n,h);grid on -20 0 20 40 60 80 100
x[n]
1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
-20 0 20 40 60 80 100
clear all
close all
n=-10:1:100;
x=1*(n>=0);
a=0.9;
h=(a.^n).*x;
y = conv(x,h);
Lx=length(x);
Lh=length(h);
Ly=length(y);
nx=0:Lx-1;
nh=0:Lh-1;
ny=0:Ly-1;
figure, stem(nx-10,x);title('x[n]');grid on
figure, stem(nh-10,h);title('h[n]');grid on
figure, stem(ny-20,y);title('y[n]');grid on
output
y[n]
10

0
-50 0 50 100 150 200
For example, given the following two sequences:
x(n) = [1 2 3 1], 0n3; h(n) = [1 2 1 -1], -1n2
 
determine the convolution y(n) = x(n) * h(n).

x = [0 1 2 3 1];
h = [1 2 1 -1];
y = conv(x,h);
Lx=length(x);
Lh=length(h);
Ly=length(y);
nx=0:Lx-1;
nh=0:Lh-1;
ny=0:Ly-1;
figure, stem(nx-1,x); title('x[n]');grid on
figure, stem(nh-1,h);title('h[n]');grid on
figure, stem(ny-2,y);title('y[n]');grid on
grid on
output

x[n]
3 h[n]
2 y[n]
8

2.5 7
1.5
6
2
1 5

4
1.5
0.5 3

2
1 0
1

0.5 0
-0.5
-1

0 -1 -2
-1 -0.5 0 0.5 1 1.5 2 2.5 3 -1 -0.5 0 0.5 1 1.5 2 -2 -1 0 1 2 3 4 5
Lab task#01

Compute and plot the convolutions x(n)*h(n) for the pairs of signals
shown in Fig.
Lab task#02

You might also like