Professional Documents
Culture Documents
Practial File: Netaji Subhas University of Technology
Practial File: Netaji Subhas University of Technology
Practial File: Netaji Subhas University of Technology
NAME - ABHINAV
ROLL NUMBER - 2018UIC3089
SUBJECT NAME - BIO-MEDICAL INSTRUMENTATION
INDEX
S Experiment
no.
1 Draw the FFT plot of the EEG and ECG signal to study the frequency
2 Calculate heart rate by threshold method
3 Find the heart rate using wavelet transform
4 Design Notch filter to remove powerline interference from the raw ECG signal
5 Simulate biopotential amplifier
6 Simulation of pacemaker
7 Study of EMG signal(Statistical features, power spectrum , histogram)
8 Design High pass , Lowpass and Bandpass filters for filtering EEG signals
9 Filter different frequency components of EEG using Butterworth bandpass filter
10 Filter EEG frequency bands using wavelet decomposition method
11 Simulation of defibrillator
12 Acquisition of PPG signal using NI-ELVIS and extract features.
EXPERIMENT – 1
AIM:
Draw the FFT plot of the EEG and ECG signal to study the frequency.
APPARATUS REQUIRED:
MATLAB & PC
Code And Result-
ECG
ECG_file = load("ecg.mat");
ECG = ECG_file.val(2,:);
T=10;
fs = 500;
N = length(ECG);
t = (0 : N-1) / fs;
figure (1);
subplot(2,1,1);
plot(t,ECG)
title ('ECG signal');
NFFT = 2 ^ nextpow2(length(ECG));
Y = fft(ECG, NFFT) / length(ECG);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp);
title('Frequency spectrum of ECG signal');
xlabel('Frequency(Hz)')
EEG
EEG_file = load("eeg.mat");
EEG = EEG_file.val(4,:);
T=10;
fs = 512;
N = length(EEG);
t = (0 : N-1) / fs;
figure (1);
subplot(2,1,1);
plot(t,EEG)
title ('EEG signal');
NFFT = 2 ^ nextpow2(length(EEG));
Y = fft(EEG, NFFT) / length(EEG);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp);
title('Frequency spectrum of EEG signal');
xlabel('Frequency(Hz)')
RESULT -
FFT of EEG and ECG signal was obtained.
EXPERIMENT – 2
AIM:
Calculate heart rate by threshold method
APPARATUS REQUIRED:
MATLAB & PC
Code And Result-
clear all
clc
load ("ecg.mat");
ECG=val(2,:);
cnt = 0;
l = length (ECG);
thresh = 0.65*max(ECG);
for i = 1:l
if(ECG(i) > thresh)
if(ECG(i) >= ECG(i-1) && ECG(i) >= ECG(i+1))
cnt = cnt + 1;
end
end
end
figure(1);
plot(ECG);
Fs =500;
t = l/Fs;
heart_rate_val = (cnt/t)*60;
title(strcat('heart rate is:',num2str(heart_rate_val),' bpm'));
RESULT -
Heat Rate was obtained by using threshold method
EXPERIMENT - 3
AIM:
Find the heart rate using wavelet transform
APPARATUS REQUIRED:
MATLAB & PC
Code And Result-
clc;
clear all;
load ("ecg.mat");
ECG=val(2,:);
n = 6;
[c,l] = wavedec(ECG,n,'db6');
for i = 1:n
a{i} = wrcoef('a',c,l,'db6',i);
d{i} = wrcoef('d',c,l,'db6',i);
end
e1 = d{3} + d{4} + d{5};
e2 = (d{4}.*(d{3} + d{5}))./2^n;
e3 = abs(e1.*e2);
figure(1),plot(e3)
title('Transform'); T = 0.15 *max(e3);
l = length(e3);
cnt = 0;
for i = 1:l
if(e3(i) > T)
if(e3(i) >=e3(i - 1) && e3(i) >= e3(i+1))
cnt = cnt+1;
end
end
end
l = length(ECG);
Fs = 500;
t=1/Fs;
heart_rate_val = cnt/t*60;
figure(2),plot(ECG(end,:));
title(strcat('heart rate = ',num2str(heart_rate_val),'bpm'));
RESULT -
Heat Rate was obtained by using wavelet method.
EXPERIMENT - 4
AIM:
Design Notch filter to remove powerline interference from the raw ECG signal.
APPARATUS REQUIRED:
MATLAB & PC
Code And Result-
clc;
clear all;
ECG_file = load("ecg.mat");
ECG = ECG_file.val(1,:);
T=10;
fs = 500;
N = length(ECG);
t = (0 : N-1) / fs;
figure (1);
subplot(2,2,1);
plot(t,ECG)
title ('ECG signal');
[b, a] = butter(3,[49,51]/(fs/2),"stop");
filtered_signal = filtfilt(b,a,ECG);
subplot(2,2,2);
plot(t,filtered_signal)
title('Filtered ECG Signal');
NFFT = 2 ^ nextpow2(length(ECG));
Y = fft(ECG, NFFT) / length(ECG);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
subplot(2,2,3);
plot(f,amp);
title('Frequency spectrum of ECG signal');
xlabel('Frequency(Hz)')
Y2 = fft(filtered_signal, NFFT) / length(filtered_signal);
amp_Y2 = 2 * abs(Y2(1:(NFFT / 2)));
subplot(2,2,4);
plot(f,amp_Y2);
title('Frequency spectrum of filtered ECG');
xlabel('Frequency (Hz)');
RESULT -
Notch filter was successfully used to remove powerline interference from the raw ECG signal.
EXPERIMENT - 5
AIM:
Simulate biopotential amplifier.
1) Design Bio-signal amplifier for the following specifications: I/P
Voltage: 0.01 mV TO 10 mV
Required O/P Voltage: 0 to 10 V
Plot the input and output. Tabulate the gain for different inpu voltages
for the same circuit.
2) Design Instrumentation amplifier for different gains 50, 100, 150, 500, 1000 and tabulate the
actual gain from the simulation
APPARATUS REQUIRED:
MATLAB & PC
Virtual Lab Link:
https://bmspcoep.vlabs.ac.in/EMGAmplifier/Theory.html?
domain=Biotechnology&lab=Biomedical%20and%20Signal%20processing%20Laboratory
RESULT -
Heat Rate was obtained by using threshold method
EXPERIMENT 6:
AIM:
I) To simulate Asynchronous pacemaker:
1.Run pacemaker simulator and observe the monophasic stimulus pulse.
2.Run pacemaker simulator and observe the biphasic stimulus pulse.
3.Run pacemaker simulator and observe the stimulus pulse by varying pulse width and voltage.
4.Run pacemaker simulator and observe the energy delivered from stimulus pulse.
II) Simulate synchronous pacemaker:
Repeat the steps for Asynchronous pacemaker.
OUTPUT:
ASYNCHRONOUS
AIM:
PROCEDURE: -
Install: https://drive.google.com/open?id=0B0V6lgtnnIOZSFBDcXoyd0Z2Z1k
Arithmetic Mean-0.003000
RMS0.022000
Standard Deviation0.022000
Variance0.000000
Kurtosis7.165000
Median-0.003000
Mode-0.003000
Skewness0.583000
Maximum0.210000
Minimum-0.100000
General DSP Functions
Power Spectrum
Histogram
Total Questions:10.000000
Correct Answers8.000000
CONCLUSION:
The experiment was performed and the observations were made.
EXPERIMENT - 8
AIM:
Design High pass, Low pass and Band pass filters for filtering EEG signals
APPARATUS REQUIRED:
MATLAB & PC
Code And Result:
clc;
clear all;
EEG_file = load("eeg.mat");
EEG = EEG_file.val(4,:);
T=10; %10sec signal
fs = 512;
N = length(EEG);
t = (0 : N-1) / fs;
figure (1);
subplot(2,1,1);
plot(t,EEG)
title ('EEG signal');
NFFT = 2 ^ nextpow2(length(EEG));
Y = fft(EEG, NFFT) / length(EEG);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp);
title('Frequency spectrum of EEG signal');
xlabel('Frequency(Hz)')
%low pass filter
[b1, a1] = butter(6,50*2/512,'low');
lp_eeg = filter(b1,a1,EEG);
figure (2);
subplot(2,1,1);
plot(t,lp_eeg)
title ('Filtered(LP,fc=50)EEG signal');
Y_lp_eeg = fft(lp_eeg, NFFT) / length(lp_eeg);
amp_lp_eeg = 2 * abs(Y_lp_eeg(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp_lp_eeg);
title('Frequency spectrum of Filtered(LP,fc=50)EEG signal');
xlabel('Frequency(Hz)')
%High pass filter out
[b2, a2] = butter(6,0.5*2/512,'high');
hp_eeg = filter(b2,a2,EEG);
figure (3);
subplot(2,1,1);
plot(t,hp_eeg)
title ('Filtered(HP,fc=0.5)EEG signal');
Y_hp_eeg = fft(hp_eeg, NFFT) / length(hp_eeg);
amp_hp_eeg = 2 * abs(Y_hp_eeg(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp_hp_eeg);
title('Frequency spectrum of Filtered(HP,fc=0.5)EEG signal');
xlabel('Frequency(Hz)')
%Band pass filter out
[b3 ,a3] = butter(3,[0.5 50]*2/512,'bandpass');
bp_eeg = filter(b3,a3,EEG);
figure(4);
subplot(2,1,1);
plot(t,bp_eeg)
title ('Filtered(BP,fc1=0.5, fc2=50)EEG signal');
Y_bp_eeg = fft(bp_eeg, NFFT) / length(bp_eeg);
amp_bp_eeg = 2 * abs(Y_bp_eeg(1:(NFFT / 2)));
subplot(2,1,2);
plot(f,amp_bp_eeg);
title('Frequency spectrum of Filtered(BP,fc1=0.5, fc2=50)EEG signal');
xlabel('Frequency(Hz)')
Result
High pass, Low pass and Band pass filters was successfully used to for filtering EEG signals.
EXPERIMENT - 9
AIM:
Filter different frequency components of EEG using Butterworth bandpass filter
APPARATUS REQUIRED:
MATLAB & PC
THEORY:
Code And Result-
clc;
clear all;
EEG_file = load("eeg.mat");
EEG = EEG_file.val(4,:);
T=10; %10sec signal
fs = 512;
N = length(EEG);
t = (0 : N-1) / fs;
figure (1);
subplot(2,1,1);
plot(t,EEG)
title ('EEG signal');
subplot(2,1,2);
fftSingle(EEG);
title('Frequency spectrum of EEG signal');
xlabel('Frequency(Hz)')
[a b] = butter(2,[0.4 4]/(512/2), 'bandpass');
[c d] = butter(2,[4 8]/(512/2), 'bandpass');
[e f] = butter(2,[8 12]/(512/2), 'bandpass');
[g h] = butter(2,[12 30]/(512/2), 'bandpass');
[i j] = butter(2,30/(512/2), 'high');
delta = filter(a,b,EEG); figure(2),subplot(2,1,1),plot(delta), title
('Delta'); subplot(2,1,2),fftSingle(delta),title('Frequency spectrum of
Delta');
xlabel('Frequency(Hz)');
theta = filter(c,d,EEG); figure(3),subplot(2,1,1),plot(theta), title
('Theta'); subplot(2,1,2),fftSingle(theta),title('Frequency spectrum of
Theta');
xlabel('Frequency(Hz)');
alpha = filter(e,f,EEG); figure(4),subplot(2,1,1),plot(alpha), title
('Alpha'); subplot(2,1,2),fftSingle(alpha), title('Frequency spectrum of
Alpha');
xlabel('Frequency(Hz)');
beta = filter(g,h,EEG); figure(5),subplot(2,1,1),plot(beta), title ('Beta');
subplot(2,1,2),fftSingle(beta), title('Frequency spectrum of Beta');
xlabel('Frequency(Hz)');
gamma = filter(i,j,EEG); figure(6),subplot(2,1,1),plot(gamma), title
('Gamma'); subplot(2,1,2),fftSingle(gamma),title('Frequency spectrum of
Gamma');
xlabel('Frequency(Hz)');
function [ output_args ] = fftSingle(sig)
T=10; %10sec signal
fs = 512;
N = length(sig);
NFFT = 2 ^ nextpow2(length(sig));
Y = fft(sig, NFFT) / length(sig);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
plot(f,amp)
end
Result
Different frequency was filtered components of EEG using Butterworth bandpass filter.
EXPERIMENT - 10
AIM:
Filter EEG frequency bands using wavelet decomposition method
APPARATUS REQUIRED:
MATLAB & PC
THEORY:
Code And Result-
clc;
clear all;
EEG_file = load("eeg.mat");
EEG = EEG_file.val(4,:);
T=10;
fs = 512;
N = length(EEG);
t = (0 : N-1) / fs;
n = 7;
wave = 'db5';
[c l] = wavedec(EEG,n,wave);
gamma = wrcoef('d',c,l,wave,4);
figure(1);
subplot(2,1,1), plot(gamma), title('gamma wave');
subplot(2,1,2), fftSingle(gamma), title('gamma frequency spectrum');
beta = wrcoef('d',c,l,wave,5); figure(2);
subplot(2,1,1), plot(beta), title('beta wave');
subplot(2,1,2), fftSingle(beta), title('beta frequency spectrum');
alpha = wrcoef('d',c,l,wave,6); figure(3);
subplot(2,1,1), plot(alpha), title('alpha wave');
subplot(2,1,2), fftSingle(alpha), title('alpha frequency spectrum');
theta = wrcoef('d',c,l,wave,7); figure(4);
subplot(2,1,1), plot(theta), title('theta wave');
subplot(2,1,2), fftSingle(theta), title('theta frequency spectrum');
delta = wrcoef('a',c,l,wave,7); figure(5);
subplot(2,1,1), plot(delta), title('delta wave');
subplot(2,1,2), fftSingle(delta), title('delta frequency spectrum');
function [ output_args ] = fftSingle(sig)
T=10;
fs = 512;
N = length(sig);
NFFT = 2 ^ nextpow2(length(sig));
Y = fft(sig, NFFT) / length(sig);
f = (fs / 2 * linspace(0, 1, NFFT / 2))';
amp = 2 * abs(Y(1:(NFFT / 2)));
plot(f,amp)
end
RESULT:
EEG frequency bands was filtered using wavelet decomposition method.
EXPERIMENT NO - 11
AIM:
Simulation of defibrillator
1.1. Run Defibrillator simulator and observe discharging waveform for sinusoidal, monophasic
and biphasic configurations
Link
https://bmsp-coep.vlabs.ac.in/Defibrillator/Theory.html?domain=Biotechnology&lab=Biomedical
%20and%20Signal%20processing%20Laboratory