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

Lab 08

This document describes using Matlab to simulate the convolution of various continuous time signals, including decaying and growing exponential signals convolved with unit step responses, as well as a cosine signal convolved with a sine signal. The lab assignment is to plot the convolution of even and odd functions with a unit impulse response.

Uploaded by

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

Lab 08

This document describes using Matlab to simulate the convolution of various continuous time signals, including decaying and growing exponential signals convolved with unit step responses, as well as a cosine signal convolved with a sine signal. The lab assignment is to plot the convolution of even and odd functions with a unit impulse response.

Uploaded by

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

Lab. No.

08

Convolution of Continuous Time Signals in Matlab


Lab. Objective: To obtain Simulation skills of convolution of different signals in Matlab.

Tools: PC, Matlab.

Convolution: To find/ plot the combine area of two continiouss time signals is called convolution.

Convolution of decaying exponential signal with system unit impulse response:

Matlab Code:
%%Convolution of decaying exponential signal with system delta responce%%

t=0:0.001:10;%defining time for first signal

A=20;%defining amplitude of first signal

a=5;%defining variable of the signal

x=A*exp(-a*t);%defining the first signal

subplot(1,3,1);%defining multiplotting command

plot(t,x)%plotting the first signal

legend('decaying exponential signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

N=30;%defining time limit for unit step function

n=-N:1:N;%defining time for unit impulse function

y=[zeros(1,N) 1 zeros(1,N)]; %defining unit impulse function

subplot(1,3,2); %defining multiplotting command

plot(n,y)%plotting the unit step function

legend('unit step function')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

z=conv(x,y); %convolution of both signals

subplot(1,3,3);%defining multiplotting command

plot(z)%plotting resultant signal

legend('resultant signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines


20 1 20
decaying exponential signal unit step function resultant signal
18 0.9 18

16 0.8 16

14 0.7 14

12 0.6 12

10 0.5 10

8 0.4 8

6 0.3 6

4 0.2 4

2 0.1 2

0 0 0
0 5 10 -50 0 50 0 1 2
4
x 10

Figure 1: Convolution of Decaying Exponential signal with System unit impulse response

Convolution of growing exponential signal with system unit step impulse response:

Matlab Code:
%%Convolution of growing exponential signal with system unit step responce%%

t=0:0.001:10;%defining time for first signal

A=20;%defining amplitude of first signal

a=5;%defining variable of the signal

x=A*exp(a*t);%defining the first signal

subplot(1,3,1);%defining multiplotting command

plot(t,x)%plotting the first signal

legend('decaying exponential signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

N=30;%defining time limit for unit step function

n=-N:1:N;%defining time for unit step function

y=[zeros(1,N) 1 ones(1,N)]; %defining unit step function

subplot(1,3,2); %defining multiplotting command

plot(n,y)%plotting the unit step function

legend('unit step function')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines


z=conv(x,y); %convolution of both signals

subplot(1,3,3);%defining multiplotting command

plot(z)%plotting resultant signal

legend('resultant signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

22 24
x 10 x 10
12 1 3
decaying exponential signal unit step function resultant signal
0.9
10 2.5
0.8

0.7
8 2
0.6

6 0.5 1.5

0.4
4 1
0.3

0.2
2 0.5
0.1

0 0 0
0 5 10 -50 0 50 0 1 2
4
x 10

Figure 2: Convolution of Growing exponential signal with system unit step response

Convolution of Cosine and Sine signals

Matlab Code:
%%Convolution of cosine and sine waveform%%

t=0:0.001:10;%defining time

A=20;%defining amplitude of cosine signal

x=A*cos(2*pi*t);%defining the cosine signal

subplot(3,1,1);%defining multiplotting command

plot(t,x)%plotting the cosine signal

legend('decaying exponential signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

B=30;%defining amplitude of sine waveform

y=B*sin(4*pi*t); %defining sine waveform


subplot(3,1,2); %defining multiplotting command

plot(t,y)%plotting sine signal

legend('unit step function')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

z=conv(x,y); %convolution of both signals

subplot(3,1,3);%defining multiplotting command

plot(z)%plotting resultant signal

legend('resultant signal')%Matlab built-inn command for labels

grid on %Matlab built-inn command for lines

20
decaying exponential signal

-20
0 1 2 3 4 5 6 7 8 9 10
50
unit step function

-50
0 1 2 3 4 5 6 7 8 9 10
5
x 10
2
resultant signal
0

-2
0 0.5 1 1.5 2 2.5
4
x 10

Figure 3: Convolution of cosine and sine waveform

Lab. Assignment:

Plot the convolution of following functions with system unit impulse response

1. Even function
2. Odd function

You might also like