Lab Manual
Lab Manual
PROCESSING LAB
LAB MANUAL
HOD-BME- ECE
TABLE OF CONTENTS
Exp. Page
Date Experiments Mark Signature
No. No.
Generation of Elementary Signals
a) Unit Impulse Signal
1 3
b) Unit Step Signal
c) Unit Ramp Signal
Generation of Signals
2 a) Exponential Signal 9
b) Power Signal
Generation of Wave Signals
3 a) Cosine Signal 13
b) Sine Signal
Convolution
4 a) Linear Convolution 17
b) Circular Convolution
Impulse Response of Difference
5 22
Equations.
Fourier Transform
6 a) Discrete Fourier Transform (DFT) 25
b) Fast Fourier Transform (FFT)
IIR Filter Design
a) Butterworth Low Pass Filter
b) Butterworth High Pass Filter
7 c) Butterworth Band Pass Filter 29
d) Butterworth Band Stop Filter
e) Digital Chebyshev (Type-1) Low
Pass Filter
Digital FIR Low Pass Filter Using Hanning
8 41
Window
Generation of Elementary Signals – Unit Impulse Signals
Aim:
To generate a Unit Impulse Signals of desired frequency and amplitude using simulation
software.
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
n=input('Enter the value of n');
x= -n:1:n;
y= [zeros(1,n),ones(1,1),zeros(1,n)];
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('Unit Impulse Signal');
Result:
COMMAND WINDOW:
OUTPUT WAVEFORM:
Generation of Elementary Signals – Unit Step Signals
Aim:
To generate a Unit Step Signals of desired frequency and amplitude using simulation
software.
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
n=input('Enter the value of n');
x= -n:1:n;
y= [zeros(1,n),ones(1,n+1)];
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('UNIT Step Sequence');
Result:
COMMAND WINDOW:
OUTPUT WAVEFORM:
Generation of Elementary Signals – Unit Ramp Signals
Aim:
To generate a Unit Ramp Signals of desired frequency and amplitude using simulation
software.
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
n=input('Enter the value of n');
x= -n:1:n;
y= [zeros(1,n+1), 1:1:n];
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('UNIT RAMP SIGNAL');
Result:
COMMAND WINDOW:
OUTPUT WAVEFORM:
Generation of Signals – Exponential Signals
Aim:
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
n=input('Enter the value of n');
x= -n:1:n;
y= exp(x);
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('Rising exponential Signal');
clc;
close all;
clear all;
n=input('Enter the value of n');
x= -n:1:n;
y= exp(-x);
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('Falling exponential Signal');
Result:
COMMAND WINDOW:
OUTPUT WAVEFORM:
Generation Signals – Power Signals
Aim:
To generate a power Signals of desired frequency and amplitude using simulation software.
Software required:
MATLAB 9
Program
clc;
close all;
clear all;
n=input('Enter the value of n');
a=input('Enter the value of a');
x= 0:1:n;
y=a.^x;
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('power Signal');
Result:
COMMAND WINDOW:
Aim:
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
x= 0:0.01:pi;
y= 5*cos(2*pi*x);
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('Discrete Cosine signal');
clc;
close all;
clear all;
x= 0:0.05:pi;
y= 5*cos(2*pi*x);
plot(x,y);
xlabel('time');
ylabel('amplitude');
title('Continuous Cosine signal');
Result:
Aim:
Software required:
MATLAB 9
Program:
DiscreteSine Wave
clc;
close all;
clear all;
x= 0:0.01:pi;
y= 5*sin(2*pi*x);
stem(x,y);
xlabel('time');
ylabel('amplitude');
title('Discrete sine signal');
clc;
close all;
clear all;
x= 0:0.05:pi;
y= 5*sin(2*pi*x);
plot(x,y);
xlabel('time');
ylabel('amplitude');
title('Continuous sine signal');
Result:
Aim:
Software required:
MATLAB 9
Program:
Result:
COMMAND WINDOW:
1 3 6 10 9 7 4
OUTPUT WAVEFORM
CIRCULAR CONVOLUTION
Aim:
Software required:
MATLAB 9
Program:
clc;
clear all;
close all;
x=input('Enter the First Sequence');
h=input('Enter the Second Sequence');
a=length(x);
b=length(h);
c=max(a,b);
y=cconv(x,h,c);
disp('Circular convolution of the sequences is');
disp(y);
subplot(3,1,1);
stem(x);
title('Circular Convolution : x(n) input seq');
xlabel('time period');
ylabel('amplitude');
subplot(3,1,2);
stem(h);
title('h(n) input seq');
xlabel('time period');
ylabel('amplitude');
subplot(3,1,3);
stem(y);
title('output seq');
xlabel('time period');
ylabel('amplitude');
Result:
Circular convolution between two sequence using MATLAB is computed .
OBSERVATION:
COMMAND WINDOW:
10 10 10 10
OUTPUT WAVEFORM
IMPULSE RESPONSE OF A DIFFERENCE EQUATION
Aim:
Y[n]+0.7y[n-1]-0.45y[n-2]-0.6y[n-3]=0.8x[n]-0.44x[n-1]+0.36x[n-2]+0.2x[n-3]
Software required:
MATLAB 9
Program:
clc;
clear all;
close all;
N = i n p u t (' E n t e r t h e r e qu i r ed l e n g t h o f i m p u l s e r e s p o n s e N= ' ) ;
n=0:N-1;
b = i n p u t ( ' E n t er t h e c o - e f f i c i e n t s o f x (n ) , b = ' ) ;
a = i n p u t ( ' E n t er t h e c o = e f f i c i e n t s o f y (n ) , a = ' ) ;
x = [ 1 , z e r o s ( 1 , N - 1 )] ;
y=filter(b,a,x);
stem(n,y);
xlabel('time');
ylabel('amplitude');
t i t l e (' I M P U L S E R E S P O N S E ' ) ;
grid on;
Result:
The impulse response of a system defined by a Difference equation using MATLAB is
computed
OBSERVATION:
Y[n]+0.7y[n-1]-0.45y[n-2]-0.6y[n-3]=0.8x[n]-0.44x[n-1]+0.36x[n-2]+0.2x[n-3]
OUTPUT:
DFT COMPUTATION
Aim:
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
n = length (x);
a = dftmtx(n);
y = x*a;
disp(y);
Result:
The MATLAB program for computing the DFT of the given sequence has been written and
verified.
OBSERVATION:
COMMAND WINDOW:
Aim:
Software required:
MATLAB 9
Program:
clc;
close all;
clear all;
y = fft(x);
disp(y);
Result:
The MATLAB program for computing the DFT of the given sequence has been written and
verified.
OBSERVATION:
COMMAND WINDOW:
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital
Butterworth Low pass filter.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
r p = i n pu t (' en t er t h e p assban d at t en u at i o n :' );
r s= i n p u t (' en t er t h e st o p ban d at t en u at i o n :' );
w p = i n pu t (' en t er t h e p ass ban d fr e qu en cy:' );
w s= i n p u t (' en t er t h e st o p ban d fr equ en cy:' );
[ N,w n ] = but t o rd (w p/ p i ,w s/ p i ,rp ,r s);
[ b,a] = bu t t er (N,w n );
fr eqz (b,a) ;
t i t l e(' bu t t er w or t h l o w p ass fi l t er ' );
RESULTS:
Thus the magnitude response and phase response of Digital Butter worth Low pass filter
was verified.
OBSERVATION:
OUTPUT:
IIR FILTER DESIGN
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital
Butterworth High pass filter.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
r p = i n pu t (' en t er t h e p assban d at t en u at i o n :' );
r s= i n p u t (' en t er t h e st o p ban d at t en u at i o n :' );
w p = i n pu t (' en t er t h e p ass ban d fr e qu en cy:' );
w s= i n p u t (' en t er t h e st o p ban d fr equ en cy:' );
[ N,w n ] = but t o rd (w p/ p i ,w s/ p i ,rp ,r s);
[ b,a] = bu t t er (N,w n ,' h i gh ' );
fr eqz (b,a) ;
t i t l e(' bu t t er w or t h h i g h p ass fi l t er ' );
RESULTS:
Thus the magnitude response and phase response of Digital Butter worth High pass filter
was verified.
OBSERVATION:
OUTPUT:
IIR FILTER DESIGN
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital
Butterworth Band pass filter.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
r p = i n pu t (' en t er t h e p assban d at t en u at i o n :' );
r s= i n p u t (' en t er t h e st o p ban d at t en u at i o n :' );
w p = i n pu t (' en t er t h e p ass ban d fr e qu en cy:' );
w s= i n p u t (' en t er t h e st o p ban d fr equ en cy:' );
[ N,w n ] = but t o rd (w p/ p i ,w s/ p i ,rp ,r s);
[ b,a] = bu t t er (N,w n ,’ban d p ass’ );
fr eqz (b,a) ;
t i t l e(' B u t t erw o rt h B an d Pass fi l t er ' );
RESULTS:
Thus the magnitude response and phase response of Digital Butter worth Band Pass filter
was verified.
OBSERVATION :
OUTPUT:
IIR FILTER DESIGN
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital
Butterworth Band Stop filter.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
r p = i n pu t (' en t er t h e p assban d at t en u at i o n :' );
r s= i n p u t (' en t er t h e st o p ban d at t en u at i o n :' );
w p = i n pu t (' en t er t h e p ass ban d fr e qu en cy:' );
w s= i n p u t (' en t er t h e st o p ban d fr equ en cy:' );
[ N,w n ] = but t o rd (w p/ p i ,w s/ p i ,rp ,r s);
[ b,a] = bu t t er (N,w n ,' st o p ' );
fr eqz (b,a) ;
t i t l e(' B u t t erw o rt h B an d S t o p fil t er ' );
RESULTS:
Thus the magnitude response and phase response of Digital Butter worth Band Stop filter
was verified.
OBSERVATION :
OUTPUT :
IIR FILTER DESIGN
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital
Chebyshev type-1 Low pass filter.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
r p = i n pu t (' E n t er th e p ass b an d at t en u a t i o n :' );
r s= i n p u t (' E nt er t h e st o p ban d at t en u at i o n :' );
w p = i n pu t (' E n t er th e p ass b an d fr equ e n cy:' );
w s= i n p u t (' E nt er t h e st o p ban d fr equ en cy:' );
[ N,w n ] = ch eb1 o r d (w p /p i ,w s/ p i ,r p ,r s);
[ b,a] = ch eby1 (N,r p ,w n );
fr eqz (b,a) ;
RESULTS:
Thus the magnitude response and phase response of digital Chebyshev type-1 Low pass
filter was verified.
OBSERVATION :
OUTPUT:
FIR FILTER DESIGN
Aim:
To write a MATLAB program to plot magnitude response and phase response of digital FIR
LP filter using Hanning window.
Software required:
MATLAB 9
Program:
cl c;
cl ear al l ;
cl o se al l ;
N= i n p u t (' En t er t h e val u e o f N:' );
w c= i n p u t (' E n t er cu to ff fr equ en cy:' );
h = fi r 1 (N,w c/ p i ,h an n i ng (N+ 1 ));
fr eqz (h );
RESULTS:
Thus the magnitude response and phase response of digital FIR LP filter using Hanning
window was verified.
OBSERVATION:
OUTPUT: