Autocorrelation of vector or matrix input
Statistics
dspstat3
The Autocorrelation block computes the autocorrelation along
the first dimension of an ND input array. The block accepts fixedpoint
signals when you set the Computation domain to Time
.
When the input to the Autocorrelation block is an MbyN matrix u, the output, y, is an (l+1)byN matrix whose jth column has elements
$${y}_{i,j}={\displaystyle \sum _{k=0}^{Ml1}{u}_{k,j}^{*}{u}_{(k+i),j}^{}}\text{}0\le \text{}i\text{}\le \text{}l$$
where * denotes the complex conjugate, and l represents the maximum lag. y_{0,j} is the zerolag element in the jth column. When you select Compute all nonnegative lags, l=M–1. Otherwise, l is the nonnegative integer value you specify for the Maximum nonnegative lag (less than input length) parameter.
Similarly, for an ND input array, the block outputs an ND 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 MbyNbyP array, the Autocorrelation block outputs an (l+1)byNbyP array.
The following diagrams show the data types used within the Autocorrelation block for fixedpoint 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.
The Main pane of the Autocorrelation block dialog appears as follows.
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
nonnegative lag (less than input length) parameter.
Specify the maximum positive lag, l, for the autocorrelation. This parameter is available only when you clear the Compute all nonnegative lags check box.
This parameter controls the scaling that the block applies to the output. The following options are available:
None
— Generates the raw
autocorrelation y_{i,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}}{Mi}$$
Unity at zerolag
—
Normalizes the estimate of the autocorrelation for each channel so
that the zerolag sum is identically 1.
$${y}_{0,j}=1$$
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 
The Data Types pane of the Autocorrelation block dialog appears as follows.
Note
Fixedpoint signals are only supported for the time domain.
To use the parameters on this pane, make sure 
Select the rounding mode for fixedpoint operations.
Note: The Rounding mode and Overflow mode settings have no effect on numerical results when all the following conditions exist:
With these data type settings, the block is effectively operating in full precision mode. 
Select the overflow mode for fixedpoint operations.
Specify the product output data type. See FixedPoint 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.
See Specify Data Types Using Data Type Assistant for more information.
Specify the accumulator data type. See FixedPoint 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.
See Specify Data Types Using Data Type Assistant for more information.
Specify the output data type. See FixedPoint 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.
See Control Signal Data Types for more information.
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 fixedpoint data types
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 fixedpoint data types
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify on the block mask.
Port  Supported Data Types 

Input 

Output 

Correlation  DSP System Toolbox 
xcorr  Signal Processing Toolbox 