xcorr
Cross correlation.
Syntax
Rxy=xcorr(x)
Rxy=xcorr(x,y)
Inputs
- x
- As a vector x is the first signal.
- y
- The second signal.
Outputs
- Rxy
- The cross correlation.
Examples
Vector example:
x = [2,3,4,5,6];
y = [4,6,7,8];
Rxy = xcorr(x,y)
Rxy = [Matrix] 1 x 8
16 38 65 94 119 88 56 24
Matrix
example:
z = [1,2;3,4;5,6;7,8];
Rxy = xcorr(z)
Rxy = [Matrix] 7 x 4
7 8 14 16
26 30 38 44
53 62 68 80
84 100 100 120
53 68 62 80
26 38 30 44
7 14 8 16
Comments
When x is a vector and y is omitted, the auto-correlation of x is computed.
When x is a matrix with N columns, y must be omitted and Rxy is a matrix with N^2 columns. The correlation of columns i and j of x is stored in column (i-1)*N + j of Rxy.