Autocorrelation of ND array
DSP System Toolbox / Statistics
The Autocorrelation block computes the autocorrelation along the first dimension of an ND input array. 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 input signal is convolved with its timereversed complex conjugate. In the frequency domain, the block computes the autocorrelation by taking the Fourier transform of the input signal, multiplying the Fourier transform with its conjugate, and computing the inverse Fourier transform of the product. In this domain, depending on the input length, the block can require fewer computations. For information on these two computation methods, see Algorithms.
You can specify the maximum lag for autocorrelation using the Compute all nonnegative lags and Maximum nonnegative lag (less than input length) parameters.
The block accepts fixedpoint signals when you set the Computation
domain to Time
.
Port_1
— Data inputData input. The block accepts realvalued or complexvalued
multichannel and multidimensional inputs. The input can be a fixedpoint
signal when you set the Computation domain to
Time
.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 fixed point
Complex Number Support: Yes
Port_1
— Autocorrelated outputAutocorrelated output of the data input.
When the input is an MbyN matrix, u, the output, y, is an (l+1)byN matrix. l is the maximum positive lag for autocorrelation.
When the input is an ND array, the block outputs an ND array. 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 block outputs an (l+1)byNbyP array.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 fixed point
Complex Number Support: Yes
Compute all nonnegative lags
— Compute autocorrelation over all nonnegative lagsWhen you select this parameter, the Autocorrelation
block computes the autocorrelation over all nonnegative lags in the
range [0, length(input)
– 1]. When you clear this
parameter, the block computes the autocorrelation using the lags in the
range [0, l], where l is the value
you specify in Maximum nonnegative lag (less than input
length).
Maximum nonnegative lag (less than input length)
— Maximum positive lag1
(default)  integer greater than or equal to 0 and less than input lengthMaximum positive lag for autocorrelation, specified as an integer that is greater than or equal to 0 and less than the input length.
To enable this parameter, clear the Compute all nonnegative lags parameter.
Scaling
— Scaling of the outputNone
(default)  Biased
 Unbiased
 Unity at zerolag
Scaling applied to the output.
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, the first element in each column, is
identically 1.
$${y}_{0,j}=1$$
Computation domain
— Domain in which the block computes the autocorrelationTime
(default)  Frequency
Time
— Computes the
convolutions in the time domain, which minimizes the memory
usage.
Frequency
— Computes the
autocorrelation in frequency domain. For more information,
see Algorithms.
To autocorrelate fixedpoint signals, set this parameter to
Time
.
Note
Fixedpoint signals are supported for the time domain only. To use these
parameters, on the Main tab, set Computation
domain to Time
.
Rounding mode
— Method of rounding operationFloor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Simplest
 Zero
Specify the rounding mode for fixedpoint operations as one of the following:
Floor
Ceiling
Convergent
Nearest
Round
Simplest
Zero
For more details, see rounding mode.
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 fullprecision mode.
Saturate on integer overflow
— Method of overflow actionWhen you select this parameter, the block saturates the result of its
fixedpoint operation. When you clear this parameter, the block wraps
the result of its fixedpoint operation. For details on
saturate
and wrap
, see overflow
mode for fixedpoint operations.
Note
The Rounding mode and Saturate on integer overflow parameters have no effect on numeric 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
.
With these data type settings, the block operates in fullprecision mode.
Product output
— Product output data typeInherit: Inherit via internal
rule
(default)  Inherit: Same as input
 fixdt([],16,0)
Product output specifies the data type of the output of a product operation in the Autocorrelation block. For more information on the product output data type, see Multiplication Data Types and the 'FixedPoint 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, binarypoint, scaled, fixedpoint 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
— Accumulator data typeInherit: Inherit via internal
rule
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt([],16,0)
Accumulator specifies the data type of the output of an accumulation operation in the Autocorrelation block. For illustrations on how to use the accumulator data type in this block, see the 'FixedPoint 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, binarypoint, scaled, fixedpoint 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
— Output data typeInherit: Same as
accumulator
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt([],16,0)
Output specifies the data type of the output of the Autocorrelation block. For more information on the output data type, see the 'FixedPoint 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, binarypoint, scaled, fixedpoint 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).
Output Minimum
— Minimum value the block can output[]
(default)  scalarSpecify the minimum value the block can output. Simulink^{®} software uses this minimum value to perform:
Simulation range checking. See Specify Signal Ranges (Simulink).
Automatic scaling of fixedpoint data types.
Output Maximum
— Maximum value block can output[]
(default)  scalarSpecify the maximum value the block can output. Simulink software uses this maximum value to perform:
Simulation range checking. See Specify Signal Ranges (Simulink).
Automatic scaling of fixedpoint data types.
Lock data type settings against changes by the fixedpoint tools
— Prevent fixedpoint tools from overriding data typesoff
(default)  on
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify on the block dialog.
Data Types 

Multidimensional Signals 

VariableSize Signals 

Autocorrelation is the correlation of a signal with itself at different points in time.
For a deterministic discretetime sequence, x(n), the autocorrelation is computed using the following relationship:
$${r}_{x}(h)={\displaystyle \sum _{n=0}^{Nh1}{x}^{*}}(n)x(n+h)\text{\hspace{1em}}h=0,1,\dots ,N1$$
where h is the lag and * denotes the complex conjugate. If the input is a length N realization of a WSS stationary random process, r_{x}(h) is an estimate of the theoretical autocorrelation:
$${\rho}_{x}(h)=E\{{x}^{*}(n)x(n+h)\}$$
where E{
} is the expectation operator. The Unity at zerolag
normalization divides
each sequence value by the autocorrelation or autocorrelation estimate
at zero lag.
$$\frac{{\rho}_{x}(h)}{{\rho}_{x}(0)}=\frac{E\{{x}^{*}(n)x(n+h)\}}{E\left\{\rightx(0){}^{2}\}}$$
The most commonly used estimate of the theoretical autocorrelation of a WSS random process is the biased estimate:
$${\widehat{\rho}}_{x}(h)=\frac{1}{N}{\displaystyle \sum _{k=0}^{Nh1}{x}^{*}}(n)x(n+h)$$
When you set the computation domain to time, the algorithm computes the autocorrelation of the input signal in the time domain. The input signal can be a fixedpoint signal in this domain.
The autocorrelation sequence, y, is computed using this equation:
$${y}_{i,j}={\displaystyle \sum _{k=0}^{Ml1}{u}_{k,j}^{*}{u}_{(k+i),j}^{}}\text{}0\le \text{}i\text{}\le \text{}l$$
y_{0,j} is the zerolag element in the jth column of the input.
i is the index of the lag.
j is the index of the input data column.
*
denotes the complex conjugate.
M is the number of elements in each column.
l is the maximum positive lag for autocorrelation. When you choose to compute the autocorrelation with all nonnegative lags, l=M–1. Otherwise, l is the maximum nonnegative integer lag value specified.
u is an MbyN input matrix.
When you set the computation domain to frequency, the algorithm computes the autocorrelation in the frequency domain.
In this domain, the algorithm computes the autocorrelation sequence by taking the Fourier transform of the input signal, multiplying the Fourier transform with its complex conjugate, and taking the inverse Fourier transform of the product. In this domain, depending on the input length, the algorithm can require fewer computations.
Generated code relies on memcpy
or
memset
functions (string.h
) under certain
conditions.
These diagrams show the data types that the Autocorrelation block uses for fixedpoint signals (time domain only).
You can set the product output, accumulator, and output data types on the Data Types tab of the block.
When the input is real, the output of the multiplier is in the product output data type. When the input is complex, the output of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.