Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Cross-correlation

`r = xcorr(x,y)`

`r = xcorr(x)`

`r = xcorr(___,maxlag)`

`r = xcorr(___,scaleopt)`

```
[r,lags]
= xcorr(___)
```

returns
the cross-correlation of two discrete-time sequences, `r`

= xcorr(`x`

,`y`

)`x`

and `y`

.
Cross-correlation measures the similarity between `x`

and
shifted (lagged) copies of `y`

as a function of
the lag. If `x`

and `y`

have
different lengths, the function appends zeros at the end of the shorter
vector so it has the same length, * N*, as the other.

`r = xcorr(___,`

limits
the lag range from –`maxlag`

)`maxlag`

to `maxlag`

.
This syntax accepts one or two input sequences. `maxlag`

defaults
to * N – 1*.

[1] Buck, John R., Michael M. Daniel, and Andrew C. Singer. *Computer
Explorations in Signals and Systems Using MATLAB*.
2nd Edition. Upper Saddle River, NJ: Prentice Hall, 2002.

[2] Stoica, Petre, and Randolph Moses. *Spectral
Analysis of Signals*. Upper Saddle River, NJ: Prentice
Hall, 2005.

Was this topic helpful?