Signal Processing Toolbox |
Cross-covariance function (equal to mean-removed cross-correlation)
Syntax
v=
xcov(x,y) v=
xcov(x) v=
xcov(x,'option') [c,lags]=
xcov(x,y,maxlags) [c,lags]=
xcov(x,maxlags) [c,lags]=
xcov(x,y,maxlags,'option
')
Description
xcov
estimates the cross-covariance sequence of random processes. Autocovariance is handled as a special case.
The true cross-covariance sequence is the cross-correlation of mean-removed sequences
where and are the mean values of the two stationary random processes, and E{·} is the expected value operator. xcov
estimates the sequence because, in practice, access is available to only a finite segment of the infinite-length random process.
v
returns the cross-covariance sequence in a length 2N-1 vector, where =
xcov(x,y)
x
and y
are length N vectors. For information on how arrays are processed with xcov, see Multiple Channels.
v
is the autocovariance sequence for the vector =
xcov(x)
x
. Where x
is an N-by-P array, v =
xcov(x) returns an array with 2N-1 rows whose P2 columns contain the cross-covariance sequences for all combinations of the columns of x
.
By default, xcov
computes raw covariances with no normalization. For a length N vector
The output vector c
has elements given by c(m)
= cxy(m-N), m = 1, ..., 2N-1.
The covariance function requires normalization to estimate the function properly.
v
specifies a scaling option, where =
xcov(x,'option
')
'
option
'
is
'biased'
, for biased estimates of the cross-covariance function
'unbiased'
, for unbiased estimates of the cross-covariance function
'coeff'
, to normalize the sequence so the auto-covariances at zero lag are identically 1.0
'none'
, to use the raw, unscaled cross-covariances (default)
See [1] for more information on the properties of biased and unbiased correlation and covariance estimates.
[c,lags]
where =
xcov(x,y,maxlags)
x
and y
are length m
vectors, returns the cross-covariance sequence in a length 2*maxlags+1
vector c
. lags
is a vector of the lag indices where c
was estimated, that is, [-maxlags:maxlags]
.
[c,lags]
is the autocovariance sequence over the range of lags =
xcov(x,maxlags)
[-maxlags:maxlags]
.
[c,lags]
where =
xcov(x,maxlags)
x
is an m
-by-p
array, returns array c
with 2*maxlags+1
rows whose P2 columns contain the cross-covariance sequences for all combinations of the columns of x
.
[c,lags]
specifies a scaling option, where =
xcov(x,y,maxlags,'option
')
'
option
'
is the last input argument.
In all cases, xcov
gives an output such that the zeroth lag of the covariance vector is in the middle of the sequence, at element or row maxlag+1
or at m
.
Examples
The second output lags
is useful when plotting. For example, the estimated autocovariance of uniform white noise cww(m) can be displayed for -10 m 10 using:
ww=
randn(1000,1); % Generate uniform noise with mean=
1/2. [cov_ww,lags]=
xcov(ww,10,'coeff'); stem(lags,cov_ww)
Algorithm
xcov
computes the mean of its inputs, subtracts the mean, and then calls xcorr
. For more information on estimating covariance and correlation functions, see [1].
Diagnostics
xcov
does not check for any errors other than the correct number of input arguments. Instead, it relies on the error checking in xcorr
.
See Also
conv
, corrcoef
, cov
, xcorr
, xcorr2
References
[1] Orfanidis, S.J., Optimum Signal Processing. An Introduction. 2nd Edition, Prentice-Hall, Englewood Cliffs, NJ, 1996.
xcorr2 | yulewalk |
© 1994-2005 The MathWorks, Inc.