Accelerating the pace of engineering and science

# Autocorrelation

Autocorrelation of vector or matrix input

Statistics

dspstat3

## Description

The Autocorrelation block computes the autocorrelation along the first dimension of an N-D input array. The block accepts fixed-point signals when you set the Computation domain to Time.

When the input to the Autocorrelation block is an M-by-N matrix u, the output, y, is an (l+1)-by-N matrix whose jth column has elements

where * denotes the complex conjugate, and l represents the maximum lag. y0,j is the zero-lag element in the jth column. When you select Compute all non-negative lags, l=M–1. Otherwise, l is the nonnegative integer value you specify for the Maximum non-negative lag (less than input length) parameter.

Similarly, for an N-D input array, the block outputs an N-D array, where the size of the first dimension is l+1, and the sizes of all other dimensions match those of the input array. For example, when the input is an M-by-N-by-P array, the Autocorrelation block outputs an (l+1)-by-N-by-P array.

### Fixed-Point Data Types

The following diagrams show the data types used within the Autocorrelation block for fixed-point signals (time domain only).

You can set the product output, accumulator, and output data types on the Data Types pane of 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.

## Dialog Box

The Main pane of the Autocorrelation block dialog appears as follows.

Compute all non-negative lags

When you select this check box, the block computes the autocorrelation over all nonnegative lags in the range [0, length(input)-1]. When you clear the check box, the block computes the autocorrelation using lags in the range [0, l], where l is the value you specify for the Maximum non-negative lag (less than input length) parameter.

Maximum non-negative lag (less than input length)

Specify the maximum positive lag, l, for the autocorrelation. This parameter is available only when you clear the Compute all non-negative lags check box.

Scaling

This parameter controls the scaling that the block applies to the output. The following options are available:

• None — Generates the raw autocorrelation yi,j without normalization.

• Biased — Generates the biased estimate of the autocorrelation.

${y}_{i,j}^{biased}=\frac{{y}_{i,j}}{M}$

• Unbiased — Generates the unbiased estimate of the autocorrelation.

${y}_{i,j}^{unbiased}=\frac{{y}_{i,j}}{M-i}$

• Unity at zero-lag — Normalizes the estimate of the autocorrelation for each channel so that the zero-lag sum is identically 1.

${y}_{0,j}=1$

Computation domain

This parameter sets the domain in which the block computes convolutions to one of the following settings:

• Time — Computes in the time domain, which minimizes memory use

• Frequency — Computes in the frequency domain, which might require fewer computations than computing in the time domain, depending on the input length

 Note   This parameter must be set to Time for fixed-point signals.

The Data Types pane of the Autocorrelation 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.
Rounding mode

Select the rounding mode for fixed-point operations.

 Note:   The Rounding mode and Overflow mode settings have no effect on numerical results when all the following conditions exist:Product output data type is Inherit: Inherit via internal ruleAccumulator data type is Inherit: Inherit via internal ruleOutput data type is Inherit: Same as accumulatorWith these data type settings, the block is effectively operating in full precision mode.
Overflow mode

Select the overflow mode for fixed-point operations.

Product output data type

Specify the product output data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:

• A rule that inherits a data type, for example, Inherit: Inherit via internal rule

• An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output data type parameter.

Accumulator data type

Specify the accumulator data type. See Fixed-Point Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:

• A rule that inherits a data type, for example, Inherit: Inherit via internal rule

• An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator data type parameter.

Output data type

Specify the output data type. See Fixed-Point Data Types for illustrations depicting the use of the output data type in this block. You can set it to:

• A rule that inherits a data type, for example, Inherit: Same as accumulator

• An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

Minimum

Specify the minimum value that the block should output. The default value is [] (unspecified). Simulink® software uses this value to perform:

• Simulation range checking (see Signal Ranges)

• Automatic scaling of fixed-point data types

Maximum

Specify the maximum value that the block should output. The default value is [] (unspecified). Simulink software uses this value to perform:

• Simulation range checking (see Signal Ranges)

• Automatic scaling of fixed-point data types

Lock data type settings against changes by the fixed-point tools

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

## Supported Data Types

PortSupported Data Types

Input

• Double-precision floating point

• Single-precision floating point

• Fixed point (signed and unsigned)

• 8-, 16-, and 32-bit signed integers

• 8-, 16-, and 32-bit unsigned integers

Output

• Double-precision floating point

• Single-precision floating point

• Fixed point (signed and unsigned)

• 8-, 16-, and 32-bit signed integers

• 8-, 16-, and 32-bit unsigned integers