% error: [c, lag] = xcov (X [, Y] [, maxlag] [, scale]) % % Compute covariance at various lags [=correlation(x-mean(x),y-mean(y))]. % % X: input vector % Y: if specified, compute cross-covariance between X and Y, % otherwise compute autocovariance of X. % maxlag: is specified, use lag range [-maxlag:maxlag], % otherwise use range [-n+1:n-1]. % Scale: % 'biased' for covariance=raw/N, % 'unbiased' for covariance=raw/(N-|lag|), % 'coeff' for covariance=raw/(covariance at lag 0), % 'none' for covariance=raw % 'none' is the default. % % Returns the covariance for each lag in the range, plus an % optional vector of lags.