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

Lab Manual

Uploaded by

Fadhili Mungah
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)
18 views

Lab Manual

Uploaded by

Fadhili Mungah
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/ 40

BIOMEDICAL SIGNAL AND IMAGE

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

Exp. No.: 1 a) Date:

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:

A Unit Impulse Signals was generated using MATLAB


OBSERVATION:

COMMAND WINDOW:

Enter the value of n - 5

OUTPUT WAVEFORM:
Generation of Elementary Signals – Unit Step Signals

Exp. No.: 1 b) Date:

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:

A Unit Step Signals was generated using MATLAB


OBSERVATION:

COMMAND WINDOW:

Enter the value of n - 5

OUTPUT WAVEFORM:
Generation of Elementary Signals – Unit Ramp Signals

Exp. No.: 1 c) Date:

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:

A Unit Ramp Signals was generated using MATLAB


OBSERVATION:

COMMAND WINDOW:

Enter the value of n - 5

OUTPUT WAVEFORM:
Generation of Signals – Exponential Signals

Exp. No.: 2 a) Date:

Aim:

To generate an Exponential signal of desired frequency and amplitude using simulation


software.

Software required:

MATLAB 9

Program:

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('Rising exponential Signal');

Falling 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:

Exponential Signals was generated using MATLAB


OBSERVATION:

COMMAND WINDOW:

Enter the value of n - 5

OUTPUT WAVEFORM:
Generation Signals – Power Signals

Exp. No.: 2 b) Date:

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:

A power Signals was generated using MATLAB


OBSERVATION:

COMMAND WINDOW:

Enter the value of n - 5


Generation Signals – Cosine Wave

Exp. No.: 3 a) Date:

Aim:

To generate a cosine wave of desired frequency and amplitude using MATLAB.

Software required:

MATLAB 9

Program:

Discrete Cosine Wave

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');

Continuous Cosine Wave

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:

A Cosine wave of frequency, f and amplitude, A was generated using MATLAB


OUTPUT WAVEFORM:
Generation Signals – Sine Wave

Exp. No.: 3 b) Date:

Aim:

To generate a sine wave of desired frequency and amplitude using MATLAB .

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');

Continuous Sine Wave

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:

A sine wave of frequency, f and amplitude, A was generated using MATLAB


OUTPUT WAVEFORM:
LINEAR CONVOLUTION

Exp. No.: 4 a) Date:

Aim:

To compute Linear convolution between two sequence using MATLAB .

Software required:

MATLAB 9

Program:

clc; clear all; close all;


x=input('Enter the First Sequence');
h=input('Enter the Second Sequence');
y=conv(x,h);
disp('linear Convolution of the sequence is');
disp(y);
subplot(3,1,1);
stem(x);
title('linear 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:

Linear convolution between two sequence using MATLAB is computed .


OBSERVATION:

COMMAND WINDOW:

Enter the First Sequence [1 2 3 4]

Enter the Second Sequence [1 1 1 1]

linear Convolution of the sequence is

1 3 6 10 9 7 4

OUTPUT WAVEFORM
CIRCULAR CONVOLUTION

Exp. No.: 4 b) Date:

Aim:

To compute circular convolution between two sequence using MATLAB .

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:

Enter the First Sequence [1 2 3 4]

Enter the Second Sequence [1 1 1 1]

Circular Convolution of the sequences is

10 10 10 10

OUTPUT WAVEFORM
IMPULSE RESPONSE OF A DIFFERENCE EQUATION

Exp. No.: 5 Date:

Aim:

To compute the impulse response of a system defined by a Difference equation using


MATLAB.

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]

Enter the required length of impulse response N = 40


Enter the co-efficients of x(n), b = [0.8 -0.44 0.36 0.02]
Enter the co=efficients of y(n), a = [1 0.7 -0.45 -0.6]

OUTPUT:
DFT COMPUTATION

Exp. No.: 6 a) Date:

Aim:

To compute DFT of a sequence using MATLAB .

Software required:

MATLAB 9

Program:

clc;

close all;

clear all;

x = input(' Enter the sequence');

n = length (x);

a = dftmtx(n);

y = x*a;

disp('DFT of the sequence is');

disp(y);

Result:

The MATLAB program for computing the DFT of the given sequence has been written and
verified.
OBSERVATION:

COMMAND WINDOW:

Enter the sequence - [ 1 , 2 , 3 , 4]

DFT of the sequence is

10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i


FFT COMPUTATION

Exp. No.: 6 b) Date:

Aim:

To compute FFT of a sequence using MATLAB .

Software required:

MATLAB 9

Program:

clc;

close all;

clear all;

x = input(' Enter the sequence');

y = fft(x);

disp('FFT of the sequence is');

disp(y);

Result:

The MATLAB program for computing the DFT of the given sequence has been written and
verified.
OBSERVATION:

COMMAND WINDOW:

Enter the sequence - [ 1 , 2 , 3 , 4]

DFT of the sequence is

10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i


IIR FILTER DESIGN

DIGITAL BUTTERWORTH LOW PASS FILTER

Exp. No.: 7 a) Date:

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:

enter the passband attenuation : 0.4


enter the stop band attenuation : 30
enter the pass band frequency : 0.2*pi
enter the stop band frequency : 0.4*pi

OUTPUT:
IIR FILTER DESIGN

DIGITAL BUTTERWORTH HIGH PASS FILTER

Exp. No.: 7 b) Date:

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:

Enter the pass band attenuation : 0.4


Enter the stop band attenuation : 30
Enter the pass band frequency : 0.6*pi
Enter the stop band frequency : 0.2*pi

OUTPUT:
IIR FILTER DESIGN

DIGITAL BUTTERWORTH BANDPASS FILTER

Exp. No.: 7 c) Date:

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 :

enter the passband attenuation : 0.2


enter the stop band attenuation : 20
enter the pass band frequency : [0.2*pi,0.4*pi]
enter the stop band frequency : [0.1*pi,0.5*pi]

OUTPUT:
IIR FILTER DESIGN

DIGITAL BUTTERWORTH BAND STOP FILTER

Exp. No.: 7 d) Date:

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 :

enter the passband attenuation : 0.2


enter the stop band attenuation : 20
enter the pass band frequency : [0.1*pi,0.5*pi]
enter the stop band frequency : [0.2*pi,0.4*pi]

OUTPUT :
IIR FILTER DESIGN

DIGITAL CHEBYSHEV(TYPE-1) LOW PASS FILTER

Exp. No.: 7 e) Date:

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 :

enter the passband attenuation : 0.2


enter the stop band attenuation : 20
enter the pass band frequency : [0.1*pi,0.5*pi]
enter the stop band frequency : [0.2*pi,0.4*pi]

OUTPUT:
FIR FILTER DESIGN

DIGITAL FIR LP FILTER USING HANNING WINDOW

Exp. No.: 8 Date:

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:

Enter the value of N : 28

Enter cutoff frequency : 0.5*pi

OUTPUT:

You might also like