This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

dsp.Autocorrelator System object

Autocorrelation sequence


The Autocorrelator object returns the autocorrelation sequence for a discrete-time, deterministic input, or the autocorrelation sequence estimate for a discrete-time, wide-sense stationary (WSS) random process at positive lags.

To obtain the autocorrelation sequence:

  1. Define and set up your autocorrelator. See Construction.

  2. Call step to compute the autocorrelation sequence according to the properties of dsp.Autocorrelator. The behavior of step is specific to each object in the toolbox.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


ac = dsp.Autocorrelator returns an autocorrelator, ac, that computes the autocorrelation along the first dimension of an N-D array. By default, the autocorrelator computes the autocorrelation at lags from zero to N – 1, where N is the length of the input vector or the row dimension of the input matrix. Inputting a row vector results in a row of zero-lag autocorrelation sequence values, one for each column of the row vector. The default autocorrelator returns the unscaled autocorrelation and performs the computation in the time domain.

ac = dsp.Autocorrelator('PropertyName',PropertyValue, ...) returns an autocorrelator, ac, with each property set to the specified value.



Source of maximum lag

Specify how to determine the range of lags for the autocorrelation as Auto or Property. If the value of MaximumLagSource is Auto, the autocorrelator computes the autocorrelation over all nonnegative lags in the interval [0, N-1], where N is the length of the first dimension of the input. Otherwise, the object computes the autocorrelation using lags in the range [0,MaximumLag]. The default is Auto.


Maximum positive lag

Specify the maximum lag as a positive integer. This property applies only when the MaximumLagSource property is Property. The MaximumLag must be less than the length of the input data. The default is 1.


Autocorrelation function scaling

Specify the scaling to apply to the output as None, Biased, Unbiased, or Unity at zero-lag. Set this property to None to generate the autocorrelation function without scaling. This option is appropriate if you are computing the autocorrelation of a nonrandom (deterministic) input.

The Biased option scales the autocorrelation by 1/N, where N is the length of the input data. Scaling by 1/N yields a biased, finite-sample approximation to the theoretical autocorrelation of a WSS random process. In spite of the bias, scaling by 1/N has the desirable property that the sample autocorrelation matrix is nonnegative definite, a property possessed by the theoretical autocorrelation matrices of all wide-sense stationary random processes. The Fourier transform of the biased autocorrelation estimate is the periodogram, a widely used estimate of the power spectral density of a WSS process.

The Unbiased option scales the estimate of the autocorrelation by 1/N-1. Scaling by N – 1 produces an unbiased estimate of the theoretical autocorrelation. However, using the unbiased option, you can obtain an estimate of the autocorrelation function that fails to have the nonnegative definite property.

Use the Unity at zero-lag option to normalize the autocorrelation estimate as identically one at lag zero. The default is None.


Domain for computing autocorrelations

Specify the domain for computing autocorrelations as Time Domain or Frequency Domain. You must set this property to Time Domain for fixed-point signals. The default is Time Domain.

 Fixed-Point Properties


stepAutocorrelation sequence
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

ac1 = dsp.Autocorrelator;
% x is a column vector
x = (1:100)';
y = ac1(x);

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Compute the autocorrelation of a sine wave in white Gaussian noise with approximate 95% upper and lower confidence limits.

S = rng('default');
% Sine wave with period N=4
x = 1.4*cos(pi/2*(1:100))'+randn(100,1); 
MaxLag = 20;
ac = dsp.Autocorrelator('MaximumLagSource',...
'Property','MaximumLag',MaxLag,'Scaling','Unity at zero-lag');
SigAutocorr = ac(x);
stem(SigAutocorr,'b','markerfacecolor',[0 0 1]);
axis([1 20 -1 1]);
title('Sine Wave + Noise Autocorrelation'); xlabel('Lag');

As this figure shows, the autocorrelation estimate demonstrates the four sample periodic sine wave with excursions outside the 95% white Gaussian noise confidence limits every two samples.


expand all


expand all

Extended Capabilities

Introduced in R2012a

Was this topic helpful?