| Signal Processing Blockset™ | ![]() |
Statistics
dspstat3
The Correlation block computes the cross-correlation of the first dimension of a sample-based N-D input array u, and the first dimension of a sample-based N-D input array v. The block can also independently cross-correlate a sample-based vector with the first-dimension of an N-D input array. For frame-based inputs, the Correlation block computes the cross-correlation of analogous columns of an Mu-by-N input matrix u and an Mv-by-N input matrix v. The Correlation block can also independently cross-correlate a single-channel frame-based column vector with each column of a multiple-channel frame-based matrix.
The frame status of both inputs to the Correlation block must be the same. The output of the block is always sample-based.
The Correlation block accepts both real and complex floating-point and fixed-point inputs. Fixed-point signals are not supported for the frequency domain.
When the inputs to the Correlation block are an Mu-by-N frame-based input matrix u and an Mv-by-N frame-based input matrix v, the output, y, is a sample-based (Mu+Mv–1)-by-N matrix whose jth column has elements

where * denotes the complex conjugate. Inputs u and v are zero when indexed outside of their valid ranges. When both inputs are real, the output is real; when one or both inputs are complex, the output is complex.
When one input is a column vector (single channel) and the other is a matrix (multiple channels), the single-channel input is independently cross-correlated with each channel of the multichannel input. Each column of the input represents a separate channel. For example, when u is a Mu-by-1 column vector and v is an Mv-by-N matrix, the output is an (Mu+Mv–1)-by-N matrix whose jth column has elements

The Correlation block supports sample-based N-D array input. The cross-correlation for sample-based N-D inputs is always computed across the first dimension. If both inputs are N-D arrays, the size of their first dimensions can differ, but the size of all other dimensions must be equal. For example, when u is an Mu-by-N-by-P array and v is an Mv-by-N-by-P array, the output, y, is a sample-based (Mu+Mv–1)-by-N-by-P array.
When one input is an N-D sample-based array and the other is a vector, the vector is independently cross-correlated with each column of the N-D input. For example, when u is a Mu-by-1 column vector and v is an Mv-by-N-by-P array, the output is an (Mu+Mv-1)-by-N-by-P array.
The Correlation block also accepts two vector inputs. When u and v are sample-based column vectors with lengths Mu and Mv, the Correlation block performs the vector cross-correlation according to the following equation:

The dimensions of the sample-based output vector are determined by the dimensions of the input vectors:
When both inputs are column vectors, or when one input is a column vector and the other is a 1-D vector, the output is a (Mu+Mv–1)-by-1 column vector.
When both inputs are row vectors, or when one input is a row vector and the other is a 1-D vector, the output is a 1-by-(Mu+Mv–1) row vector.
When both inputs are 1-D vectors, the output is a 1-D vector of length Mu+Mv–1.
The following diagram shows the data types used within the Correlation block for fixed-point signals (time domain only).

You can set the product output, accumulator, and output data types in the block dialog as discussed in the next section.
The output of the multiplier is in the product output data type when the input is real. When the input is complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types.
The Main pane of the Correlation block dialog appears as follows.

Set the domain in which the block computes correlations:
Time — The block computes in the time domain, which minimizes memory use.
Frequency — The block computes in the frequency domain, which might require fewer computations than computing in the time domain, depending on the input length.
Fastest — The block computes in the domain, which minimizes the number of computations.
The Fixed-point pane of the Correlation block dialog appears as follows.

Note Fixed-point signals are only supported for the time domain. To use the parameters on this pane, make sure Time is selected for the Computation domain parameter on the Main pane. |
Select the rounding mode for fixed-point operations.
Select the overflow mode for fixed-point operations.
Use this parameter to specify how you want to designate the product output word and fraction lengths. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block:
When you select Inherit via internal rule, the product output word length and fraction length are calculated automatically. For information about how the product output word and fraction lengths are calculated when an internal rule is used, see Inherit via Internal Rule.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of zero.

As depicted above, inputs to the accumulator are cast to the accumulator data type. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how you want to designate this accumulator word and fraction lengths.
You also use this parameter to specify the accumulator word and fraction lengths resulting from a complex-complex multiplication in the block. See Multiplication Data Types for more information.
When you select Inherit via internal rule, the accumulator word length and fraction length are calculated automatically. For information about how the accumulator word and fraction lengths are calculated when an internal rule is used, see Inherit via Internal Rule.
When you select Same as product output, these characteristics match those of the product output.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of zero.
Choose how you specify the word length and fraction length of the output of the block:
When you select Same as accumulator, these characteristics match those of the accumulator.
A special case occurs when Inherit via internal rule is specified for Accumulator, and both block inputs are complex. In that case, the output word length is one less than the accumulator word length.
When you select Same as product output, these characteristics match those of the product output.
When you select Same as first input, these characteristics match those of the first input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of zero.
Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool.
| Port | Supported Data Types |
|---|---|
Input |
|
Output |
|
| Autocorrelation | Signal Processing Blockset |
| Convolution | Signal Processing Blockset |
| xcorr | Signal Processing Toolbox |
![]() | Convolution | Counter | ![]() |
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |