Main Content

Sample cross-correlation

`crosscorr(`

plots the cross-correlation function (XCF) between the two univariate, stochastic time series `y1`

,`y2`

)`y1`

and `y2`

with confidence bounds.

`crosscorr(`

uses additional options specified by one or more name-value pair arguments. For example, `y1`

,`y2`

,`Name,Value`

)`crosscorr(y1,y2,'NumLags',10,'NumSTD',2)`

plots the sample XCF of `y1`

and `y2`

for `10`

lags and displays confidence bounds consisting of `2`

standard errors.

returns the sample XCF of `xcf`

= crosscorr(___)`y1`

and `y2`

using any of the input arguments in the previous syntaxes.

`crosscorr(`

plots on the axes specified by `ax`

,___)`ax`

instead
of the current axes (`gca`

). `ax`

can precede any of the input
argument combinations in the previous syntaxes.

If

`y1`

and`y2`

have different lengths, then MATLAB appends enough zeros to the end of the shorter vector to make both vectors the same size.`crosscorr`

uses a Fourier transform to compute the XCF in the frequency domain, then converts back to the time domain using an inverse Fourier transform.`crosscorr`

plots the XCF when you do not request any output or when you request the fourth output.

[1] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. *Time Series Analysis: Forecasting and Control*. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.