Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Cross-correlation of two inputs

The `dsp.Crosscorrelator`

System
object™ computes the cross-correlation of two *N*-D input arrays along
the first dimension. The computation can be done in the time domain or frequency domain. You
can specify the domain through the Method property. In the time domain, the object convolves
the first input signal, *u*, with the time-reversed complex conjugate of the
second input signal, *v*. To compute the cross-correlation in the frequency
domain, the object:

Takes the Fourier transform of both input signals, resulting in

*U*and*V*.Multiplies

*U*and*V*, where * denotes the complex conjugate.^{*}Computes the inverse Fourier transform of the product.

If you set `Method`

to `'Fastest'`

, the
object chooses the domain that minimizes the number of computations. For information on these
computation methods, see Algorithms.

To obtain the cross-correlation for two discrete-time deterministic inputs:

Create the

`dsp.Crosscorrelator`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`xcorr = dsp.Crosscorrelator`

`xcorr = dsp.Crosscorrelator(Name,Value)`

returns a
cross-correlator object, `xcorr`

= dsp.Crosscorrelator`xcorr`

, that computes the cross-correlation of
two inputs in the time domain or frequency domain.

returns a cross-correlator object with each specified property set to the specified value.
Enclose each property name in single quotes.`xcorr`

= dsp.Crosscorrelator(`Name,Value`

)

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

`y = xcorr(u,v)`

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)