Biomedical Engineering Reference
In-Depth Information
based on curve fitting techniques. A more realistic signal
will still have more realistic frequency content.
2.2.2.2 Reading PhysioBank data
To solve some of the problems, one may have to access
the PhysioBank archives using the Chart-O-Matic Web
browser (which uses the PhysioToolkit function rdsamp).
The instructions are to download a text file and write
a MATLAB script that would read the text file. There are
also MATLAB scripts available to read the raw Physio-
Bank data files directly.
Example 2.2.2 Read and visualize PhysioBank signals
and annotations.
The ECG data available through PhysioBank is stored in
a unique format called the "212" format. Download the
relevant sample problem and display it directly in
MATLAB using the rddata.m script.
Throughout this text, we have stressed the value of
using arguments to functions to preserve their flexibility.
In the rddata.m script, the parameters of pathname,
header, attribute, and data file names are not arguments,
but are assignment statements that must be modified.
The output, when using the MIT-BIH sample data file
(in three parts 100.hea, 100.atr and 100.dat), is shown
in Fig. 2.2-5 .
Although difficult to dissect at first glance, the graph
shows that the ECG recording is just over 80 seconds
long. A small section of the data can be viewed by
extracting the data (and attributes and annotations) from
the MATLAB workspace variables. The MATLAB
Figure 2.2-6 The first 1440 samples from the 100.dat file in
the MIT-BIH database.
variable M contains the sampled data, that is, two signals,
one in each column of the array.
The sampling frequency is stored in a separate
MATLAB variable, sfreq. For the given sample, the
sampling rate was 360. If the subject's heart rate was 60
bpm, at the given sample rate, 4 QRS complexes would
be captured in 1440 samples.
Displaying the first 1440 samples of the first channel,
as shown in Fig. 2.2-6 ,
plot(M(1:1440,1))
shows that the real heart rate is greater than 60 bpm.
Now that the data is in a MATLAB variable, the true
heart rate can be easily computed by finding the R waves
(the peaks) and computing the R-R interval.
There are two QRS complexes in the first 512 sam-
ples: one in the first 256 samples, and the second
somewhere between sample 256 and sample 512 (see the
graph above). The R-R interval is computed by finding
the maxima and their indices.
[p1, i1] ¼ max(M(1:256,1));
[p2,i2] ¼ max(M(256:512,1));
The amplitude and location of the peaks can be veri-
fied against the graph above. The R-R interval is:
RR ¼ (i2 þ 256)-i1;
Heart rate is the inverse of the R-R interval. Since the
data is sampled at 360 samples per second, the heart rate
can be estimated by
360*60/RR
ans ¼
73.4694
Figure 2.2-5 ECG sample data file from the MIT-BIH database.
Search WWH ::




Custom Search