Correlation
A cross-correlation function of two input data.
blockType: Correlation
Path in the library:
|
Description
Block Correlation calculates the mutual correlation function of two input arrays of dimension along the first dimension. The calculation can be performed in the time or frequency domain.
In the time domain, the block convolves the first input signal with time-reversed complex conjugation of the second input signal .
In the frequency domain, to calculate the cross-correlation, the block:
-
Performs the Fourier transform of both input signals and .
-
Multiplies and , where — complex coupling.
-
Calculates the inverse Fourier transform for the product.
Ports
Input
#
IN_1
—
the first Input of data
vector | the matrix
Details
The block accepts multi-channel and multidimensional input data with real or complex value. When one or both of the input signals are complex, the output signal is also complex.
| Data types |
|
| Complex numbers support |
Yes |
#
IN_2
—
second data Input
vector | the matrix
Details
The block accepts multi-channel and multidimensional input data with real or complex value. When one or both of the input signals are complex, the output signal is also complex.
| Data types |
|
| Complex numbers support |
Yes |
Output
#
OUT_1
—
cross-correlated output signal
vector | the matrix
Details
Cross-correlated output of two input signals.
When the input data are multidimensional arrays, the block outputs a multidimensional array where all dimensions, with the exception of the first dimension, coincide with the input array. For example:
-
When the input signals and have dimensions on on and on on accordingly, the block Correlation outputs an array of size on on .
-
When the input signals and have dimensions on and on , the block outputs a matrix of size on .
If one input signal is a column vector and the other input signal is a multidimensional array, the block Correlation calculates the cross-correlation of a vector with each column in a multidimensional array. For example:
-
When the input signal represents a column vector of length , and — matrix size on , the block outputs a matrix of size on .
-
Similarly, when and are column vectors with lengths and Accordingly, the block performs vector cross-correlation.
| Data types |
|
| Complex numbers support |
Yes |
Additional Info
The cross-correlation function
Details
The cross—correlation function is a measure of the similarity of two discrete-time sequences depending on the delay of one relative to the other.
For two deterministic input data of length or implementations of jointly stationary wide range random processes (WSS), and , the cross-correlation is calculated using the following relation:
where
-
— delay;
-
— complex coupling.
If the input data are implementations of shared stationary random processes, It is an irregular estimate of the theoretical cross-correlation:
where — the mathematical expectation operator.
Algorithms
Calculations in the time domain
Details
The input signals can be fixed-point signals in the time domain.
correlation of two two-dimensional arrays
When the input data is two two-dimensional arrays, -th column of output data, , contains the following elements:
where
-
— complex coupling;
-
— the input matrix on ;
-
— the input matrix on ;
-
— the matrix on .
Input data and are equal to zero if they are indexed outside their acceptable ranges.
Correlation of a column vector with a two-dimensional array_
When one input signal is a column vector and the other input signal is a two-dimensional array, the algorithm independently cross-correlates the input vector with each column of the two-dimensional array., -th column of output data contains the following elements:
where
-
— complex coupling;
-
— the input matrix on ;
-
— the input matrix on ;
-
— the matrix on .
Input data and are equal to zero if they are indexed outside their acceptable ranges.
correlation of two column vectors
When the input data is two column vectors, -th column of output data contains the following elements:
where
-
— complex coupling;
-
— the input matrix on .
-
— the input matrix on ;
-
— the matrix on .
Input data and are equal to zero if they are indexed outside their acceptable ranges.
Calculations in the frequency domain
Details
To calculate the cross-correlation, the algorithm:
-
Accepts the Fourier transform of both input signals and .
-
Multiplies and , where — complex coupling.
-
Calculates the inverse Fourier transform for the product.
In this area, depending on the length of the input data, the algorithm may require fewer calculations.