Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

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.

Correlation

Cross-correlation of two N-D arrays

  • Library:
  • DSP System Toolbox / Statistics

Description

The Correlation block computes the cross-correlation of two N-D input arrays along the first-dimension. The computation can be done in the time domain or frequency domain. You can specify the domain through the Computation domain parameter. In the time domain, the block convolves the first input signal, u, with the time-reversed complex conjugate of the second input signal, v. In the frequency domain, to compute the cross-correlation, the block:

  1. Takes the Fourier transform of both input signals, U and V.

  2. Multiplies U and V*, where * denotes the complex conjugate.

  3. Computes the inverse Fourier transform of the product.

If you set Computation domain to Fastest, the block chooses the domain that minimizes the number of computations. For information on these computation methods, see Algorithms.

Ports

Input

expand all

The block accepts real-valued or complex-valued multichannel and multidimensional inputs. The input can be a fixed-point signal when you set the Computation domain to Time. When one or both of the input signals are complex, the output signal is also complex.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed_point
Complex Number Support: Yes

The block accepts real-valued or complex-valued multichannel and multidimensional inputs. The input can be a fixed-point signal when you set the Computation domain to Time. When one or both of the input signals are complex, the output signal is also complex.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed_point
Complex Number Support: Yes

Output

expand all

Cross-correlated output of the data input.

When the inputs are N-D arrays, the block outputs an N-D array, where all the dimensions, except for the first dimension, match with the input array. For example,

  • When the inputs u and v have dimensions Mu-by-N-by-P and Mv-by-N-by-P, respectively, the Correlation block outputs an (Mu + Mv – 1)-by-N-by-P array.

  • When the inputs u and v have the dimensions Mu-by-N and Mv-by-N, the block outputs an (Mu + Mv – 1)-by-N matrix.

If one input is a column vector and the other input is an N-D array, the Correlation block computes the cross-correlation of the vector with each column in the N-D array. For example,

  • When the input u is an Mu-by-1 column vector and v is an Mv-by-N matrix, the block outputs an (Mu + Mv – 1)-by-N matrix.

  • Similarly, when u and v are column vectors with lengths Mu and Mv, respectively, the block performs the vector cross-correlation.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed_point
Complex Number Support: Yes

Parameters

expand all

Main Tab

  • Time — Computes the cross-correlation in the time domain, which minimizes the memory usage.

  • Frequency — Computes the cross-correlation in the frequency domain. For more information, see Algorithms.

  • Fastest — Computes the cross-correlation in the domain that minimizes the number of computations.

To cross-correlate fixed-point signals, set this parameter to Time.

Data Types Tab

    Note   Fixed-point signals are supported for the time domain only. To use these parameters, on the Main tab, set Computation domain to Time.

Select the rounding mode for fixed-point operations.

    Note:   The Rounding mode and Saturate on integer overflow parameters have no effect on numerical results when all these conditions are met:

    • Product output data type is Inherit: Inherit via internal rule.

    • Accumulator data type is Inherit: Inherit via internal rule.

    • Output data type is Inherit: Same as accumulator.

    With these data type settings, the block operates in full-precision mode.

When you select this parameter, the block saturates the result of its fixed-point operation. When you clear this parameter, the block wraps the result of its fixed-point operation. For details on saturate and wrap, see overflow mode for fixed-point operations.

Product output specifies the data type of the output of a product operation in the Correlation block. For more information on the product output data type, see Multiplication Data Types and the 'Fixed-Point Conversion' section in Extended Capabilities.

  • Inherit: Inherit via internal rule — The block inherits the product output data type based on an internal rule. For more information on this rule, see Inherit via Internal Rule.

  • Inherit: Same as input — The block specifies the product output data type to be the same as the input data type.

  • fixdt([],16,0) — The block specifies an autosigned, binary-point, scaled, fixed-point data type with a word length of 16 bits and a fraction length of 0.

Alternatively, you can set the Product output data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button .

For more information on the data type assistant, see Specify Data Types Using Data Type Assistant (Simulink).

Accumulator specifies the data type of output of an accumulation operation in the Correlation block. For illustrations on how to use the accumulator data type in this block, see the 'Fixed-Point Conversion' section in Extended Capabilities.

  • Inherit: Inherit via internal rule — The block inherits the accumulator data type based on an internal rule. For more information on this rule, see Inherit via Internal Rule.

  • Inherit: Same as input — The block specifies the accumulator data type to be the same as the input data type.

  • Inherit: Same as product output — The block specifies the accumulator data type to be the same as the product output data type.

  • fixdt([],16,0) — The block specifies an autosigned, binary-point, scaled, fixed-point data type with a word length of 16 bits and a fraction length of 0.

Alternatively, you can set the Accumulator data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button .

For more information on the data type assistant, see Specify Data Types Using Data Type Assistant (Simulink).

Output specifies the data type of the output of the Correlation block. For more information on the output data type, see the 'Fixed-Point Conversion' section in Extended Capabilities.

  • Inherit: Same as input — The block specifies the output data type to be the same as the input data type.

  • Inherit: Same as product output — The block specifies the output data type to be the same as the product output data type.

  • Inherit: Same as accumulator — The block specifies the output data type to be the same as the accumulator data type.

  • fixdt([],16,0) — The block specifies an autosigned, binary-point, scaled, fixed-point data type with a word length of 16 bits and a fraction length of 0.

Alternatively, you can set the Output data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button .

For more information on the data type assistant, see Specify Data Types Using Data Type Assistant (Simulink).

Specify the minimum value the block can output. Simulink® software uses this minimum value to perform:

  • Simulation range checking. See Signal Ranges (Simulink).

  • Automatic scaling of fixed-point data types.

Specify the maximum value the block can output. Simulink software uses this maximum value to perform:

  • Simulation range checking. See Signal Ranges (Simulink).

  • Automatic scaling of fixed-point data types.

Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block dialog box.

More About

expand all

Algorithms

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a

Was this topic helpful?