Autocorrelation of N-D array
DSP System Toolbox / Statistics
The Autocorrelation block computes the autocorrelation along the first dimension of an N-D 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 time-reversed 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 non-negative lags and Maximum non-negative lag (less than input length) parameters.
The block accepts fixed-point signals when you set the Computation
domain to Time
.
Port_1
— Data inputData input. 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
.
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 M-by-N matrix, u, the output, y, is an (l+1)-by-N matrix. l is the maximum positive lag for autocorrelation.
When the input is an N-D array, the block outputs an N-D 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 M-by-N-by-P array, the block outputs an (l+1)-by-N-by-P array.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fixed point
Complex Number Support: Yes
Compute all non-negative 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 non-negative lag (less than input
length).
Maximum non-negative 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 non-negative lags parameter.
Scaling
— Scaling of the outputNone
(default) | Biased
| Unbiased
| Unity at zero-lag
Scaling applied to the output.
None
— Generates the raw
autocorrelation yi,j
without normalization.
Biased
— Generates the
biased estimate of the autocorrelation.
Unbiased
— Generates the
unbiased estimate of the autocorrelation.
Unity at zero-lag
—
Normalizes the estimate of the autocorrelation for each channel
so that the zero-lag sum, the first element in each column, is
identically 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 fixed-point signals, set this parameter to
Time
.
Note
Fixed-point 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 fixed-point 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 full-precision mode.
Saturate on integer overflow
— Method of overflow actionWhen 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.
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 full-precision 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 '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
— 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 '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
— 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 '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).
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 fixed-point 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 fixed-point data types.
Lock data type settings against changes by the fixed-point tools
— Prevent fixed-point tools from overriding data typesoff
(default) | on
Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block dialog.
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Autocorrelation is the correlation of a signal with itself at different points in time.
For a deterministic discrete-time sequence, x(n), the autocorrelation is computed using the following relationship:
where h is the lag and * denotes the complex conjugate. If the input is a length N realization of a WSS stationary random process, rx(h) is an estimate of the theoretical autocorrelation:
where E{
} is the expectation operator. The Unity at zero-lag
normalization divides
each sequence value by the autocorrelation or autocorrelation estimate
at zero lag.
The most commonly used estimate of the theoretical autocorrelation of a WSS random process is the biased estimate:
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 fixed-point signal in this domain.
The autocorrelation sequence, y, is computed using this equation:
y0,j is the zero-lag 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 M-by-N 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 fixed-point 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.