Biomedical Engineering Reference
In-Depth Information
Figure 2.4-13 Upper traces: An ensemble of individual (vergence) eye movement responses to a step change in stimulus. Lower
trace: The ensemble average, displaced downward for clarity. The ensemble average is constructed by averaging the individual responses
at each point in time. Hence, the value of the average response at time T1 (vertical line) is the average of the individual responses at that
time.
(Because MATLAB is case sensitive, n and N are
different variables.) The program then generates the
six sinusoids using this time vector in conjunction
with sin and cos functions, arranging the signals as
columns of x. The program then determines the co-
variance (cov) and correlation (corrcoef)matrices
of x.
fs ¼ 256;
% Assumed sample
frequency
n ¼ (1:N)/fs;
% Time vector:
1 sec of data
%
% Generate the sinusoids as columns of the
matrix
x(:,1) ¼ sin
(2*pi*n)';
% Generate a 1 HZ sin
Results: The output from this program is a covariance
and correlation matrix. The covariance matrix is as
follows:
x(:,2) ¼ 2*cos
(2*pi*n)';
% Generate a 1 HZ cos
x(:,3) ¼ 1.5*sin
(4*pi*n)';
% Generate a 2 HZ sin
Correlation Matrix S ¼
0.5020 0.0000 0.0000 0.0000 0.0000 -0.0497
0.0000 2.0078 -0.0000 -0.0000 -0.0000 -0.0137
0.0000 -0.0000 1.1294 0.0000 -0.0000 -0.2034
0.0000 -0.0000 0.0000 4.5176 -0.0000 -0.0206
0.0000 -0.0000 -0.0000 -0.0000 3.1373 -1.2907
-0.0497 -0.0137 -0.2034 -0.0206 -1.2907 1.5372
x(:,4) ¼ 3*cos
(4*pi*n)';
% Generate a 2 HZ cos
x(:,5) ¼ 2.5*sin
(6*pi*n)';
% Generate a 3 HZ sin
x(:,6) ¼ 1.75*
cos(7*pi*n)';
% Generate a 3.5 HZ cos
%
S ¼ cov(x) % print covariance
matrix
Rxx ¼ corrcoef(x) % and correlation
matrix
The diagonals of the covariance matrix give the variance
of the six signals and these differ since the amplitudes of
the signals are different. The correlation matrix shows
similar results except that the diagonals are now 1.0
because these reflect the correlation of the signal with
itself.
Analysis: Theprogramdefinesatimevectorn that is
256 points long and achieves the proper time interval
by dividing by the sampling frequency, fs (also 256).
Search WWH ::




Custom Search