From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# Signal Correlation (2D Cross Correlation) (G Dataflow)

Computes the two-dimensional cross correlation of two sequences.  ## X

The first input sequence.

This input can be a 2D array of double-precision, floating-point numbers or a 2D array of complex double-precision, floating-point numbers. ## Y

The second input sequence.

This input can be a 2D array of double-precision, floating-point numbers or a 2D array of complex double-precision, floating-point numbers. ## algorithm

The correlation method to use.

This input is available only if both x and y are arrays or waveforms.

If x and y are small, the direct method typically is faster. If x and y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

Name Description
direct

Computes the cross correlation using the direct method of linear correlation.

frequency domain

Computes the cross correlation using an FFT-based technique.

Default: frequency domain ## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error ## RXY

The cross correlation of the two input sequences.

The output can return a 2D array of double-precision, floating-point numbers or a 2D array of complex double-precision, floating-point numbers. ## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Algorithm for Calculating the 2D Cross Correlation

This node computes two-dimensional cross correlation as follows:

$h\left(i,j\right)=\sum _{m=0}^{{M}_{1}-1}\sum _{n=0}^{{N}_{1}-1}{x}^{*}\left(m,n\right)\cdot y\left(m-i,n-j\right)$

for i = -(M 1-1), ..., -1, 0, 1, ... , (M 2-1) and j = -(N 1-1), ..., -1, 0, 1, ... , (N 2-1)

where

• M 1 is the number of rows of matrix X
• N 1 is the number of columns of matrix X
• M 2 is the number of rows of matrix Y
• N 2 is the number of columns of matrix Y

The indexed elements outside the ranges of X and Y are equal to zero, as shown in the following relationships:

$x\left(m,n\right)=0,\text{}m<0\text{}\mathrm{or}\text{}m\ge {M}_{1}\text{}\mathrm{or}\text{}n<0\text{}\mathrm{or}\text{}n\ge {N}_{1}$

and

$y\left(m,n\right)=0,\text{}m<0\text{}\mathrm{or}\text{}m\ge {M}_{2}\text{}\mathrm{or}\text{}n<0\text{}\mathrm{or}\text{}n\ge {N}_{2}$

The elements of the output matrix RXY are related to the elements in h as follows:

${R}_{xy}\left(i,j\right)=h\left(i-\left({M}_{1}-1\right),j-\left({N}_{1}-1\right)\right)\text{}\text{}\mathrm{for}\text{}i=0,\text{}1,\text{}2,\text{}...,\text{}{M}_{1}+{M}_{2}-2\text{}\text{}\text{}\mathrm{and}\text{}\text{}\text{}j=0,\text{}1,\text{}2,\text{}...,\text{}{N}_{1}+{N}_{2}-2$

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application