Experiment 8

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Name: Hafiz Waqar Ahmad Bhatti

Reg. No: L1F20BSEE0053 (EB)

Experiment No. 8:
Convolution of LTI systems

Introduction
Convolution is an operation (shift and add) that can be done on any two signals. If a system is LTI, only then it's
output y(t) can be defined as the convolution of input x(t) and impulse response (h(t)) of the system. To exploit
the usefulness and properties of convolution, the system must be LTI.

Objective
The main objectives of this experiment are :

• To perform continous time Convolution of LTI systems on MATLAB.


• Learn to use the built-in conv() function of MATLAB.

Design and Caluclations


In this section all the commands will be written

nx = [1.98:0.01:5.02];
x = 1.*[nx>=2 & nx<=5];
subplot(3,1,1);
xlabel('t');
ylabel('x(t)');
plot(nx,x);
axis([-1 7 0 1]);

nh = [-0.01:0.01:1.01];
h = 1.*[nh>=0 & nh<=1];
subplot(3,1,2);
xlabel('t');
ylabel('y(t)');
plot(nh,h);
axis([-1 7 0 1]);

[y] = conv(x,h).*(0.01);
ny = 0.01.*(1:length(y)) + nx(1) + nh(1);
subplot(3,1,3);
xlabel('t');
ylabel('y(t)');
plot(ny,y);

subplot(3,1,1)
xlabel('t')

1
ylabel('x(t)')
subplot(3,1,2)
xlabel('t')
ylabel('h(t)')
subplot(3,1,3)
xlabel('t')
ylabel('y(t)')

Issues
We did not face any issues any issues in this experiment.

Conlcusion
Convolution is such an effective tool that can be utilized to determine a linear time-invariant (LTI) system’s
output from an input and the impulse response knowledge.

We can find out the unit impulse response of discrete time signal using the concept of convolution.

Applications
• Image Processing.
• Synthesizing a New Customizable Pattern Using the Impulse Response of a System.
• Signal Filtering.
• Polynomial Multiplication.

2
• Audio Processing.
• Artificial Intelligence.
• Synthesized Seismographs.
• Optics.

Lab Assignment Solution


Q-1

figure;
tx = [0:0.01:5];
x1 = tx.*[tx>=0 & tx<2];
x2 = 1.*[tx>=2 & tx<5];
x=x1+x2;
subplot(3,1,1);
plot(tx,x)
axis([0 6 0 3]);
th = [-0.10:0.01:1.10];
h = 1.*[th>=0 & th<=1];
subplot(3,1,2);
plot(th,h)
axis([-1 2 0 2]);
y = conv(x,h).*(0.01);
ny = 0.01.*(1:length(y)) + nx(1) + nh(1);
subplot(3,1,3);
plot(ny,y);

3
subplot(3,1,1)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2)
xlabel('t')
ylabel('h(t)')
subplot(3,1,3)
xlabel('t')
ylabel('y(t)')

Q-2

figure;
tx = [0.9:0.01:2.2];
x = 1.*[tx>=1 & tx<=2];
subplot(3,1,1);
plot(tx,x);
axis([0 3 0 2]);
th = [0:0.01:10];
h = exp(-th);
subplot(3,1,2);
plot(th,h);
y = conv(x,h).*(0.01);
ny = 0.01.*(1:length(y)) + nx(1) + nh(1);
subplot(3,1,3);

4
plot(ny,y);

subplot(3,1,1)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2)
xlabel('t')
ylabel('h(t)')
subplot(3,1,3)
xlabel('t')
ylabel('y(t)')

Q-3 (a)

figure;
tx=[-1.1:0.01:1.1];
x1 = exp(tx).*[tx>=-1 & tx<0];
x2 = exp(-tx).*[tx>=0 & tx<=1];
x=x1+x2;
subplot(3,1,1);
plot(tx,x);
axis([-2 2 -1.5 1.5]);
grid on
th=[-0.05:0.01:3.05];
h = 2.*[th>=0 & th<=3];
subplot(3,1,2);
plot(th,h);
axis([-1 4 0 3]);

5
grid on
y=conv(x,h).*(0.01);
ny = 0.01.*(1:length(y)) + nx(1) + nh(1);
subplot(3,1,3);
plot(ny,y);
grid on

subplot(3,1,1)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2)
xlabel('t')
ylabel('h(t)')
subplot(3,1,3)
xlabel('t')
ylabel('y(t)')

Q-3 (b)

figure;
tx=[-1:0.01:10];
x=1.*[tx>=0];
subplot(3,1,1);
plot(tx,x);
axis([-3 10 0 2])
grid on
th=[0:0.01:2];
h1=(2.*th).*[th>=0 & th<=1];

6
h2=(-2.*th+4).*[th>1 & th<=2];
h=h1+h2;
subplot(3,1,2);
plot(th,h);
grid on
y=conv(x,h).*(0.01);
ny = 0.01.*(1:length(y)) + nx(1) + ny(1);
subplot(3,1,3);
plot(ny,y);
grid on

subplot(3,1,1)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2)
xlabel('t')
ylabel('h(t)')
subplot(3,1,3)
xlabel('t')
ylabel('y(t)')

You might also like