Computes discrete auto or cross covariance
[c [,lagindex]] = xcov(x [,maxlags [,scaling]]) [c [,lagindex]] = xcov(x,y [,maxlags [,scaling]])
a vector of real or complex floating point numbers.
a vector of real or complex floating point numbers. The
default value is x.
a scalar with integer value greater than 1. The default value
is n. Where n is the maximum
of the x and y vector
length.
a character string with possible value:
"biased", "unbiased",
"coeff", "none". The default
value is "none".
a vector of real or complex floating point numbers with same
orientation as x.
a row vector, containing the lags index corresponding to the
c values.
c=xcov(x)
computes the un-normalized discrete covariance:
and return in
c
the sequence of covariance lags
with
n
is the length of
xxcov(x,y)
computes the un-normalized discrete cross covariance:
and return in
c
the sequence of cross covariance lags
with
n
is the maximum of
x
and
y
length's.If the maxlags argument is given
xcov returns in c the sequence of
covariance lags
. If
maxlags is greater than length(x),
the first and last values of c are zero.
The scaling argument decribes how
is normalized before being returned in
c:
c=
/n.c=
./(n-(-maxlags:maxlags)).c=
/(norm(x)*norm(y)).x
and
y
and only return in
c
the sequence of covariance lags
.
using
xcorr(x-mean(x),y-mean(y),...).t = linspace(0, 100, 2000); y = 0.8 * sin(t) + 0.8 * sin(2 * t); [c, ind] = xcov(y, "biased"); plot(ind, c) | ![]() | ![]() |

| Version | Description |
| 5.4.0 | xcov added. |