Biomedical Engineering Reference
In-Depth Information
2.4.4.4 Autocorrelation
and cross-correlation
Correlation Matrix Rxx ¼
1.0000 0.0000 0.0000 0.0000 0.0000 -0.0566
0.0000 1.0000 -0.0000 -0.0000 -0.0000 -0.0078
0.0000 -0.0000 1.0000 0.0000 -0.0000 -0.1544
0.0000 -0.0000 0.0000 1.0000 -0.0000 -0.0078
0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.5878
-0.0566 -0.0078 -0.1544 -0.0078 -0.5878 1.0000
The cross-correlation and autocorrelation operations are
performed with the same MATLAB routine, with auto-
correlation being treated as a special case. The program,
axcor, is supplied on the accompanying CD:
[r, lags] ¼ axcor (x,y);
Only the first input argument, x, is required. If no y
variable is specified, autocorrelation is performed and the
output is normalized to be 1.0 at zero lag. If both vari-
ables are given, the cross-correlation is normalized as in
Eq. 2.4.29 . The time shift extends over the entire range
of the longer variable. If the MATLAB signal-processing
toolbox is available, a MATLAB routine called xcorr is
available that features a wider range of options. The
axcor function produces an output argument, r, which
is an array that is twice the length of the shortest input
array. The optional output argument, lags, is simply an
array containing the lag values, which is helpful in plot-
ting the function.
Recall that auto- and cross-covariance are the same as
auto- and cross-correlation if the data have zero means.
Hence, autocovariance or cross-covariance can be
determined using axcor simply by subtracting the var-
iable means before calling the function.
The covariance and correlation between the various sig-
nals are given by the off-diagonals and are zero for all
combinations between signals 1 and 5, demonstrating the
orthogonality of all of these harmonic signals. Conversely,
nonzero covariances and correlations are found between
signals 1 through 5 and signal 6, the 3.5-Hz cosine. This
shows that the nonharmonically related cosine is not
orthogonal to any of the other sines or cosines. Note that
the bottom row is the same as the last column, reflecting
the symmetry of these matrices.
It may seem a little surprising that a 1-Hz sine wave
and a 2-Hz sine wave are orthogonal, but it is easily
demonstrated by sketching the two waveforms.
Consider the product of two sine waves seen in
Figure 2.4.14 . The first half of the 1-Hz sine wave will
be multiplied by a full cycle of the 2-Hz sine wave and
the result will be 0.0. This would be true for any higher
harmonic signal: if the 2-Hz sine wave were a 4-Hz sine
wave, for example. The orthogonality of harmonically
related sinusoids is a feature that will be used in the
Fourier transform. It means that operations (such as
correlation) involving a sinusoid do not interfere with
operations that involve sinusoids at harmonically re-
lated frequencies.
[c, lags] ¼ axcor(x-mean(x), y-mean(x));
The autocorrelation and autocovariance functions de-
scribe how one segment of data is correlated, on average,
with adjacent segments. Such correlations could be due
to memory-like properties in the process that generated
the data. Many physiological processes are repetitive,
such as respiration and heart rate, yet vary somewhat on
a cycle-to-cycle basis. Autocorrelation and cross-
correlation can be used to explore this variation. For
example, considerable interest revolves around the heart
rate and its beat-to-beat variations. Autocovariance can
be used to tell us if these variations are completely
random or if there is (again, on average) some correlation
between beats or over several beats. In this instance, we
use autocovariance, not autocorrelation, because we are
interested in correlation of heart rate variability, not the
correlation of heart rate per se. (Recall that autocovar-
iance will remove the mean value of the heart rate from
the data and analyze only the variation.) Example 2.4.10
analyzes the normal heart rate data presented in
Figure 2.4-12 (Preliminary Heart Rate) to determine the
correlation over successive beats.
Example 2.4.10: Determine if there is any correlation in
the variation between the timing of successive heart
beats under normal resting conditions.
Figure 2.4-14 A 1-Hz sine wave plotted with a 2-Hz sine wave.
The product of the two will clearly average to 0.0.
Search WWH ::




Custom Search