Signal Processing Laboratory
Signal Processing Laboratory
LAB MANUAL
Name of Student :
Roll Number :
URN Number :
Division :
Academic Year :
INDEX
Expt. Title of Experiment Performed Submitted Page Remarks
No. date date No.
No…….. of …………………. ……….. class has completed satisfactorily the …………. No. of
Date:
Experiment No: 1
Aim: Introduction to simulation tools (MATLAB) for Signal Processing Lab
Theory:
Introduction
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
Notes:
>> 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.
>> a=3
>> a=3; can you see the effect of semicolon " ; "
>> clear a
>> 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:
%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
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
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
Result:
Addition of Two Signals
Shifting a Signals
Department of Electrical Engineering Signal Processing Laboratory
Folding a Signals
Conclusion: