Biomedical Engineering Reference
In-Depth Information
Solution: Load the heart rate data taken during normal
resting conditions (file Hr_pre.mat). Isolate the heart
rate variable (the second column) and then take the
autocovariance function. Plot this function to show po-
tential correlation over approximately 30 successive
beats.
% EXAMPLE 2.4.10 and Figure 2.4-15
% Use of autocovariance to determine
the correlation
% of heart rate variation between
heart beats
%
clear all; close all;
figure ;
load Hr_pre
% Load data
[c,lags] ¼ axcor
(hr_pre-mean
(hr_pre));
% Autocovariance
(mean subtracted)
Figure 2.4-15 Autocovariance function of the heart rate from one
subject under normal resting conditions. Some correlation is
observed over approximately 10 successive heart beats.
plot(lags,c, 'k');
hold on;
% Plot
autocovariance
sinusoid ''in'' the signal at a given frequency. This strategy
is demonstrated in the next example.
plot([lags(1)
lags(end)], [0 0],'k')
% Plot zero
line for
% reference
Example 2.4.11: Find the sinusoidal content in the
EEG signal over a range of frequencies from 0.5 to 50 Hz.
The frequency resolution of the comparison should be
0.5 Hz.
xlabel('Lags (N)');
ylabel
('Autocovariance');
grid on;
axis([-30 30 -.2 1.2]); % Limit plot range
%to 30 beats
Solution: Generate a series of sine waves from 0.5 to 50
Hz in 0.5-Hz increments. (Cosine waves would work just
as well.) Cross-correlate these sine waves with the EEG
signal and find the maximum cross-correlation. Plot this
maximum correlation as a function of the sine wave
frequency. This procedure is remarkably easy to program
in MATLAB.
Analysis: After loading the data file, the program calcu-
lates the autocovariance using routine axcor. The mean
is subtracted from the data variable so that autocovar-
iance will be performed. The data are then plotted along
with a zero line and the axis is rescaled to show only the
first 30 lags. The plotting grid is enabled.
% Example 2.4.11 and Figure 2.4-16
% Comparison of sinusoids at different
frequencies with the EEG signal using
cross-correlation.
Results: The results in Figure 2.4-15 show there is high
correlation for heart beats that are within a few seconds
of each other (approximately 0.5 within 4 seconds).
This correlation falls off rapidly so there is little or no
correlation between beats that are more than about 15
seconds apart. If the variability were completely random,
the autocovariance function would be 1.0 for zero lag and
0.0 everywhere else ( Figure 2.4-10D ). Problem 15 ap-
plies this analysis to the heart rate data taken during the
meditative state.
One of the most popular reference signals is the
sinusoid. It is common to compare the signal of interest
not just with one sinusoid but with a range of sinusoids
having different frequencies. To ensure that we correlate
with a sinusoid having the most appropriate phase shift,
we use cross-correlation and take the maximum
cross-correlation values as related to the amount of
%
clear all; close all;
load eeg_data; % Get EEG data
eeg ¼ eeg/max(eeg); % Normalize eeg data
fs ¼ 50;
% Sampling frequency
t ¼ (1:length(eeg))
/fs;
% Time vector
% Cross-correlate over a range of
frequencies.
for i ¼ 1:100
f(i) ¼ i/2;
% Frequency range:
0.5 - 50 Hz
x ¼ sin(2*pi*
f(i)*t);
% Generate sin
Search WWH ::




Custom Search