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

Signal Processing Laboratory

Uploaded by

akashdh55
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)
10 views

Signal Processing Laboratory

Uploaded by

akashdh55
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/ 14

Department of Electrical Engineering Signal Processing Laboratory

Sant Dnyaneshwar Shikshan Sanstha’s


Annasaheb Dange College of Engineering & Technology, Ashta

Department of Electrical Engineering

Signal Processing Laboratory


(2EEPC209)

LAB MANUAL

Name of Student :

Roll Number :

URN Number :

Division :

Academic Year :

Subject In-charge Student Sign


Department of Electrical Engineering Signal Processing Laboratory

INDEX
Expt. Title of Experiment Performed Submitted Page Remarks
No. date date No.

This is to certify that …………………………………………………………………… Roll

No…….. of …………………. ……….. class has completed satisfactorily the …………. No. of

experiments in ……………………………………… during the year 2021-2022.

Date:

Subject Incharge HOD-EE Director


Department of Electrical Engineering Signal Processing Laboratory

Experiment No: 1
Aim: Introduction to simulation tools (MATLAB) for Signal Processing Lab

Theory:

Introduction

MATLAB is a high-performance language for technical computing. It integrates


computation, visualization, and programming in an easy-to-use environment where problems
and solutions are expressed in familiar mathematical notation. The name MATLAB stands
for matrix laboratory. MATLAB was originally written toprovide easy access to matrix.

Starting and Quitting MATLAB

 To start MATLAB, double-click the MATLAB shortcut icon on your


Windows desktop. You will know MALTAB is running when you see
the special " >> " prompt in the MATLAB Command Window.

 To end your MATLAB session, select Exit MATLAB from the File menu in
the desktop, or type quit (or exit) in the Command Window, or with easy way
by click on close button in control box.

Desktop Tools

1. Command Window: Use the Command Window to enter variables and run functions
and M-files.
2. Command History: Statements you enter in the Command Window are logged in the
Command History. In the Command History, you can view previously run statements,
and copy and execute selected statements.
3. Current Directory Browser: MATLAB file operations use the current directory
reference point. Any file you want to run must be in the current directory or on the
search path.
4. Workspace: The MATLAB workspace consists of the set of variables (named arrays)
built up during a MATLAB session and stored in memory.
Department of Electrical Engineering Signal Processing Laboratory

5. Editor/Debugger Window: Use the Editor/Debugger to create and debug M-


files.
Department of Electrical Engineering Signal Processing Laboratory

Notes:

 A semicolon " ; " at the end of a MATLAB statement suppresses


printing of results.
 If a statement does not fit on one line, use " . . . ", followed by
Enter to indicate thatthe statement continues on the next line.
For example:

>> S= sqrt
(225)*30 /...
(20*sqrt (100)
 If we don’t specify an output variable, MATLAB uses the
variable ans (short for
answer), to store the last results of a calculation.
 Use Up arrow and Down arrow to edit previous commands
you entered inCommand Window.
 Insert " % " before the statement that you want to use it as
comment; the statementwill appear in green color.

Now Try to do the following:

>> a=3

>> a=3; can you see the effect of semicolon " ; "

>> a+5 assign the sum of a and 5 to ans

>> b=a+5 assign the sum of a and 5 to b

>> clear a

>> a can you see the effect of clear command

>> clc clean the screen

>> b
Department of Electrical Engineering Signal Processing Laboratory

Conclusion:
Department of Electrical Engineering Signal Processing Laboratory

Experiment No: 2
Aim: Generation of elementary continuous and discrete time signals

Program:

%Sinusoidal Signal (CT)%


clc;
clear all;
t=0:0.01:0.5;
f=5;
x=sin(2*pi*f.*t);
subplot(2,1,1)
plot(t,x)
xlabel('Time(t)');
ylabel('sin(wt)');
title('Sinusoidal Signal (Continuous Time)');

%Sinusoidal Signal (DT)%


clc;
clear all;
t=0:0.01:0.5;
f=5;
x=sin(2*pi*f.*t);
subplot(2,1,2)
stem(t,x)
xlabel('Time(n)');
ylabel('sin(wn)');
title('Sinusoidal Signal (Discrete Time)');

%DT Signals
%Impulse Signal %
t=-2:1:2;
impulse=[zeros(1,2) ones(1,1) zeros(1,2)];
subplot(3,1,1)
stem(t,impulse)
xlabel('Time(t)');
ylabel('magnitude');
title('Impulse Signal');

%Step Signal%
Department of Electrical Engineering Signal Processing Laboratory

t=-2:1:2;
step=[zeros(1,2) ones(1,3)];
subplot(3,1,2)
stem(t,step)
xlabel('Time(t)');
ylabel('magnitude');
title('Step Signal');

%ramp signal %
n=0:7;
if n>=0
r=n;
end
subplot(3,1,3)
stem(n,r)
xlabel('Time(n)');
ylabel('magnitude');
title('Ramp Signal');

Result:
Sinusoidal Signal (Continuous Time)
1

0.5
sin(wt)

-0.5

-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time(t)
Sinusoidal Signal (Discrete Time)
1

0.5
sin(wn)

-0.5

-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time(n)
Department of Electrical Engineering Signal Processing Laboratory

Impulse Signal
1
magnitude

0.5

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time(t)
Step Signal
1
magnitude

0.5

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time(t)
Ramp Signal
10
magnitude

0
0 1 2 3 4 5 6 7
Time(n)

Conclusion:
Department of Electrical Engineering Signal Processing Laboratory

Experiment No: 3
Aim: Perform various operations on signals and sequences such as addition, multiplication,
scaling, shifting, folding, computation of energy and average power.

Program:
Addition of Two Signals
% Define two signals
t = 0:0.01:1; % Time vector
x1 = sin(2*pi*5*t); % Signal 1: Sinusoidal signal with frequency 5 Hz
x2 = cos(2*pi*3*t); % Signal 2: Cosinusoidal signal with frequency 3
Hz

% Add the signals


x_sum = x1 + x2;

% Plot the signals and their sum


subplot(3,1,1);
plot(t, x1);
title('Signal 1: sin(2*pi*5*t)');
subplot(3,1,2);
plot(t, x2);
title('Signal 2: cos(2*pi*3*t)');
subplot(3,1,3);
plot(t, x_sum);
title('Sum of Signals');

Multiplication of Two Signals


% Define two signals
t = 0:0.01:1; % Time vector
x1 = sin(2*pi*5*t); % Signal 1: Sinusoidal signal with frequency 5 Hz
x2 = cos(2*pi*3*t); % Signal 2: Cosinusoidal signal with frequency 3Hz

% Multiply the signals


x_mul = x1 .* x2;

% Plot the signals and their multiplication


subplot(3,1,1);
plot(t, x1);
title('Signal 1: sin(2*pi*5*t)');
subplot(3,1,2);
plot(t, x2);
title('Signal 2: cos(2*pi*3*t)');
subplot(3,1,3);
plot(t, x_mul);
title('Multiplication of Signals');

Scaling of Two Signals


% Define a signal
t = 0:0.01:1; % Time vector
x = sin(2*pi*5*t); % Sinusoidal signal with frequency 5 Hz
Department of Electrical Engineering Signal Processing Laboratory

% Scale the signal by a factor of 2


x_scaled = 2 * x;

% Plot the original and scaled signals


subplot(2,1,1);
plot(t, x);
title('Original Signal: sin(2*pi*5*t)');
subplot(2,1,2);
plot(t, x_scaled);
title('Scaled Signal (Factor of 2)');

Shifting a Signals
% Define a signal
t = 0:0.01:1; % Time vector
x = sin(2*pi*5*t); % Sinusoidal signal with frequency 5 Hz

% Shift the signal by 0.5 seconds to the right


shift_amount = 0.5;
t_shifted = t - shift_amount;
x_shifted = sin(2*pi*5*t_shifted);

% Plot the original and shifted signals


subplot(2,1,1);
plot(t, x);
title('Original Signal: sin(2*pi*5*t)');
subplot(2,1,2);
plot(t_shifted, x_shifted);
title('Shifted Signal (0.5 seconds to the right)');

Folding a Signals
% Define a signal
t = 0:0.01:1; % Time vector
x = sin(2*pi*5*t); % Sinusoidal signal with frequency 5 Hz

% Fold the signal


t_folded = -t; % Flip the time axis
x_folded = sin(2*pi*5*t_folded); % Signal after folding

% Plot the original and folded signals


subplot(2,1,1);
plot(t, x);
title('Original Signal: sin(2*pi*5*t)');
subplot(2,1,2);
plot(t_folded, x_folded);
title('Folded Signal');
Department of Electrical Engineering Signal Processing Laboratory

Result:
Addition of Two Signals

Multiplication of Two Signals


Department of Electrical Engineering Signal Processing Laboratory

Scaling of Two Signals

Shifting a Signals
Department of Electrical Engineering Signal Processing Laboratory

Folding a Signals

Conclusion:

You might also like