c = xcorr2(a,b) —
returns the cross-correlation of the matrices a and b without scaling. Function xcorr2 — this is a two-dimensional version of the function xcorr.
c = xcorr2(a) —
the autocorrelation matrix of the input matrix a. This syntax is equivalent to xcorr2(a,a).
#c is a two-
dimensional cross-correlation or autocorrelation matrix
+
the matrix
Details
A two-dimensional cross-correlation or autocorrelation matrix returned as a matrix.
Additional Info
Two-dimensional cross-correlation
Two-dimensional cross-correlation of the matrix size on and matrices size on It represents a matrix size on . Its elements are given by the formula
Where the hell is means complex conjugation.
The output matrix It has negative and positive row and column indexes.
A negative row index corresponds to a shift in the rows of the matrix up.
A negative column index corresponds to a shift in the columns of the matrix to the left.
A positive row index corresponds to a shift in the rows of the matrix down.
A positive column index corresponds to a shift in the columns of the matrix to the right.
To convert the indexes to the Engee form, add the size of the matrix — element corresponds to the element C(k+P,l+Q) in the workspace.
For example, consider the following two-dimensional cross-correlation:
X = ones(2,3);
H = [1 2; 3 4; 5 6]; # H is 3 by 2
C = xcorr2(X,H)
C =
6 11 11 5
10 18 18 8
6 10 10 4
2 3 3 1
Element C(1,1) the output data corresponds to in a characteristic equation that uses indexing from scratch. To calculate an element C(1,1), move it H two rows up and one column to the left. Accordingly, the only product in the sum of the cross-correlation will be X(1,1)*H(3,2)=6. Using the characteristic equation, we obtain
in this case, all other terms of the double sum are equal to zero.