0% found this document useful (0 votes)
3 views7 pages

Ss Lab2

The document outlines an experiment for performing mathematical operations on signals using MATLAB, including operations like addition, subtraction, multiplication, time scaling, time shifting, and convolution of signals. It provides detailed code snippets for each operation along with instructions for generating graphs. The document also includes sections for results, inference, and evaluation criteria for the experiment.

Uploaded by

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

Ss Lab2

The document outlines an experiment for performing mathematical operations on signals using MATLAB, including operations like addition, subtraction, multiplication, time scaling, time shifting, and convolution of signals. It provides detailed code snippets for each operation along with instructions for generating graphs. The document also includes sections for results, inference, and evaluation criteria for the experiment.

Uploaded by

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

Karnataka Law Society’s

Gogte Institute of Technology, Udyambag, Belagavi


Department of Electronics and Communication Engineering

CO PO
Experiment No: 2 Date:
Title: Mathematical operations on given signals

Objective: To perform various mathematical operations on given signals.

Software Needed: MATLAB

Problem Statement:
Write the program to perform the following:
a. Mathematical operations of signals
b. Time scaling of continuous time signals
c. Time shifting of discrete time signals
d. Time shifting of continious time signals
e. Convolution of two signals

Code:
a. Mathematical operations of signals
clc;
close all;
clear all;
x=[1 2 3 4 0];
n=-1:1:3; %n=[-1 0 1 2 3];
subplot(5,1,1);
stem(n,x);
title('X');
y=[0 1 1 1 1];
subplot(5,1,2);
stem(n,y);
title('Y');
z=x+y;
s=x-y;
m=x.*y;
subplot(5,1,3);
stem(n,z);
title('Z=X+Y');
subplot(5,1,4);
stem(n,s);
title('S=X-Y');
subplot(5,1,5);
stem(n,m);
title('M=X*Y');

Signals and Systems 22EC34_2023-24


Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

b. Time scaling of continuous time signals


close all;
clear all;
clc;
t=0:0.01:8*pi;
x=sin(t);
subplot(3,1,1);
plot(t,x);
title('Simple Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
% expansion of signals
y=sin(t/4);
subplot(3,1,2)
plot(t,y);
title('Expanded Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
% compression of signals
y=sin(t*5);
subplot(3,1,3)
plot(t,y);
title('COMPRESSED Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;

c. Time shifting of discrete time signals


%Time shifting of discrete time signals
clc;
clear all;
close all;
n1=input('Enter the amount to be delayed');
n2=input('Enter the amount to be advanced');
n=-2:2;
x=[-2 3 0 1 5];
subplot(3,1,1);
stem(n,x);
axis([-10 10 -5 6]);
title('Signal x(n)');

Signals and Systems 22EC34_2023-24


Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

%______________Delayed signal______
m=n+n1;
subplot(3,1,2);
stem(m,x);
axis([-10 15 -5 6]);
title('Delayed signal x(n-n1)');
%%___________Advanced signal____________
t=n-n2;
subplot(3,1,3);
stem(t,x);
axis([-10 10 -5 6]);
title('Advanced signal x(n+n2)');

d. Time shifting of Continuous Time signals


close all;
clear all;
clc;
t=0:0.01:2*pi;
x=sin(t);
subplot(3,1,1);
plot(t,x);
title('Simple Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
%%---time delay of signals----
y=sin(t-2);
subplot(3,1,2);
plot(t,y);
%axis([-2,10,0,1])
title('time delayed Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;
z=sin(t+3);
subplot(3,1,3);
plot(t,z);
%%---time advancement of signals----
title('time advanced Signal');
xlabel('Time');
ylabel('Amplitude');
grid on;

Signals and Systems 22EC34_2023-24


Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

e. Convolution of two signals


clc; close all; clear all;
%program for convolution of two sequences
n=-1:3;
x=input('enter input sequence: ');
h=input('enter impulse response: ');
y=conv(x,h);
subplot(3,1,1);
stem(n,x);
xlabel('n');
ylabel('x(n)');
title('input sequence')
subplot(3,1,2);
stem(n,h);
xlabel('n');
ylabel('h(n)');
title('impulse response sequence')
subplot(3,1,3);
n1=-1:7;
stem(n1,y);
xlabel('n1');
ylabel('y(n1)');
title('linear convolution')
disp('linear convolution y=');
disp(y)

% %program for signal convolution in continuous time domain


t=0:0.1:10;
x1=sin(2*pi*t);
h1=cos(2*pi*t);
y1=conv(x1,h1);
figure;
subplot(3,1,1);
plot(x1);
xlabel('t');
ylabel('x(t)');
title('input signal')
subplot(3,1,2);
plot(h1);
xlabel('t');
ylabel('h(t)');
title('impulse response')
subplot(3,1,3);
plot(y1);
xlabel('n');
ylabel('y(t)');
title('linear convolution');
Signals and Systems 22EC34_2023-24
Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Manual Graph:

Signals and Systems 22EC34_2023-24


Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Simulated Graph:

Signals and Systems 22EC34_2023-24


Karnataka Law Society’s
Gogte Institute of Technology, Udyambag, Belagavi
Department of Electronics and Communication Engineering

Results:

Inference:

Evaluation:

Conduction(5)
Results/Outcome(5)
Viva(5)
Total(15)

Signature of Faculty-In-Charge

Signals and Systems 22EC34_2023-24

You might also like