Sei sulla pagina 1di 4

Lab 1: ECG Signal Sampling and Processing Guy Everett & Mackenzie Andrews, Section D

information from the ECG signal which can be


Lab 1: ECG Signal displayed in a wave plot on the monitor.
Sampling and Processing The electrode positions were adjusted
until a clear and consistent signal was
generated by the monitor. ECG data was then
INTRODUCTION collected under varying conditions: while
relaxed, after vigorous exercise, while
The aim of this lab is to understand the performing the Valsalva maneuver, and while
data acquisition and processing method of lowering the fs to extinguish the ECG signal. This
electrocardiograms (ECGs). ECGs measure the data was then plotted in excel and processed in
electrical activity of the heart and can be used MATLAB with a running average and sinusoidal
to track heart rate and diagnose cardiac curve fit.
abnormalities. In order to convert this complex
physiological signal into an understandable RESULTS AND DISCUSSION
format, the digitized data collected by the ECG
leads must be processed and subsequently Before testing the various conditions, a
plotted into a visual wave graph. Physicians (or comparison between different positions for the
students) to gain useful information about the electrodes to find the optimal location was
subject’s heart can then efficiently interpret carried out. The conditions tested were distal
such a graph. and proximal locations and then an
In the field of bioengineering, ECGs can intermediate based on the results observed
be a good introduction to help students from the first two trials. Figure 1 shows the ECG
understand the ways in which signals (in this signals at each location. The final decision was
case electrophysiological signals from the heart) to place the electrode with 2 of them in the
can be processed using programs such as crooks of the elbows and the final one placed
MATLAB and excel. This can also be used as a on the right wrist.
learning tool to understand the significance of
sampling rates, resolution, ways to reduce noise
in data presentation, the limitations of the
running-average algorithm, and as a model for
curve-fitting.

METHODS

The methodology of this lab begins with


the data acquisition. Electrodes were attached
to the student at 3 locations: the right wrist,
inside of the right elbow, and inside of the left
elbow. The electrodes were attached to leads
Figure 1: ECG recordings at 3 different electrode locations. The
that were connected to an ADC. The digital first location was proximal to the heart, the second location was
information generated by the ADC was sent to distal to the heart, and the third was found by trial and error until
a consistent action potential reading was observed.
the Vernier LabPro device which sends a data
file to the computer. This data file contains
voltage readings from the 3 leads and the time With the electrodes in the ideal
position, ECG recordings were taken while the

1
Lab 1: ECG Signal Sampling and Processing Guy Everett & Mackenzie Andrews, Section D

student was calm, after vigorous exercise, and would not be able to pump blood through the
with a diminished sampling frequency. These body efficiently and quickly. Comparing the
readings were then plotted using MATLAB amplitude of the ECG with other groups there
(Figure 2). were some differences that is explained by the
The absolute maximum heartbeat fact that people have different sized bodies as
recorded was after vigorous exercise with a well as circulatory systems of different
value of 120 bpm (2 Hz). The minimum strengths based on such factors as their activity
heartbeat recorded was 60 bpm (1 Hz) which level and health.
was recorded when the subject was calm. ECG’s In any given signal, there is a high
have a maximum frequency which would likelihood of noise being present. This noise
correspond to the maximum heart rate of a can be caused by a variety of things depending
human. The maximum heart rate in individual on the type of data being recorded. In this lab,
can achieve without serious damage to the where voltage is the recorded information,
heart can be calculated using the Haskell and noise is generated by anything that generates a
Fox formula (HRmax = 220 – age).1 The student voltage besides the heart (Figure 3). An example
was 20 years old so the maximum heart rate of used in class was the voltage generated by cell
that individual would be 200 bpm which would phones but noise could also be introduced by
give a maximum frequency of 3.3 Hz. the subject’s breathing, muscle contractions in
After vigorous exercise the ECG signal muscles besides the heart, or even ions found in
increased in frequency by approximately a sweat that encounters the electrodes.
factor of 2. This is likely due to the need for the
heart to be more active to deliver enough blood
to muscles needed to maintain the activity level
of the subject.

Figure 3: A noise softening algorithm was used to smooth out the


raw ECG curve (top) to a more interpretable, de-noised curve
(bottom) without losing the QRS curve information.

Figure 2: ECG recordings of student under 1) calm conditions, 2)


after running, and 3) with a lowered sampling frequency. A running average algorithm was used
to smooth the ECG graph. The running average
The amplitude of the subject’s ECG was algorithm fails once the points averaged
constant. The electrical impulses generated by a exceeds around 10 the QRS-complex is
healthy heart should be consistent or the heart eliminated from the graph. One advantage of

2
Lab 1: ECG Signal Sampling and Processing Guy Everett & Mackenzie Andrews, Section D

the running average algorithm is that it is used


to smooth out curves to make the graphs of
data readable. If care is not taken with the size
of the range, the average is taken over then
information is lost. To use the running average REFERENCES
properly it is then important to understand
what sort of data is called “noise” and what 1. Robergs R and Landwehr R (2002). "The
data the person analyzing the signal needs. Surprising History of the 'HRmax=220-
age' Equation" (PDF). Journal of Exercise
Signals Physiology 5 (2): 1–10.
2. Grenander, Ulf (1959). Probability and
The Nyquist frequency is used to determine the Statistics: The Harald Cramér Volume.
minimum sampling frequency needed to ensure Wiley. The Nyquist frequency is that
that the signal is acquired properly. It is defined frequency whose period is two
to be a frequency in hertz that is twice the sampling intervals.
greatest frequency of the signal being recorded.
In the case of action potentials that can fire at APPENDIX
the rate of 1000Hz it would require the time
frequency of sampling to be equal 2000Hz.2 The Authors: Guy Everett & Mackenzie Andrews
sampling time required then is equal to 1/2000 For bioen 317 lab 1 with the purpose of
sec. The sampling frequency in this lab was set generating the needed figures as well as
to record data every 5 milliseconds to acquire creating the sine function for the sinusoidal
the data from an action potential the sampling wave fit.
frequency would have to be increased to every close all ;clc; clear all;
0.5 milliseconds if no action potential wanted to
be missed or recorded improperly.
C2 = dlmread('C2.txt', '\t', 7, 0);
C3 = dlmread('C3.txt', '\t', 7, 0);
C5 = dlmread('C5.txt', '\t', 7, 0);
C4 = dlmread('C4.txt', '\t', 7, 0);

smooth = zeros(2000,1);
for n = 1:2000
sum = 0;
for i = 1:5
sum = sum+C4(n+i,2);
end
ave = sum/5;
smooth(n)=ave;
end

Figure 4: A sinusoidal wave superimposed on an ECG signal. The subplot(2,1,1);


peak of the sine wave corresponds to the peak of the QRS wave in figure1=plot(C2(1:2000,1),C2(1:2000,2)+1,'b');
amplitude and time, the trough of the sine wave corresponds in
amplitude to the trough of the QRS wave.
hold on;

figure1=plot(C3(1:2000,1),C3(1:2000,2),'r');

3
Lab 1: ECG Signal Sampling and Processing Guy Everett & Mackenzie Andrews, Section D

hold on;
figure1=plot(C5(1:100,1),C5(1:100,2)-1,'g');
legend('Calm','Running','Lowered fs');
axis([0 10 -2 2]);
grid on;
title('ECG');
xlabel('time (sec)');
ylabel('voltage (mV)');

subplot(2,1,2);
figure2=plot(C4(1:2000,1),C4(1:2000,2),'b');
hold on;
figure2=plot(C4(1:2000,1),smooth(1:2000)-
1,'r');
legend('Noisy', 'Smoothed');
axis([0 10 -2 1]);
grid on;
title('Noise Softening');
xlabel('time (sec)');
ylabel('voltage (mV)');

p2=C2(71:201,:);
plot(p2(:,1),p2(:,2))
hold on;
p3=p2(:,2);
peak=max(p3);
p4=-p3;
trough=-max(p4);
amp=peak+(-trough);
amp2=(peak+trough)/2;
f=@(n)
0.5199*sin(2*pi*n*.005*1.538+105.76*pi)+am
p2;
x=[1:130,1].';
y=[];
p1=p2(:,1);
for j=1:131;
y(j,1)=f(x(j));
end

plot(p1,y)
grid on;
title('superimposed sinusoid');
xlabel('time (sec)');
ylabel('voltage (mV)');

Potrebbero piacerti anche