# Correlation and Convolution

Cross-correlation, autocorrelation, cross-covariance, autocovariance, linear and circular convolution

Signal Processing Toolbox™ provides a family of correlation and convolution functions that let you detect signal similarities. Determine periodicity, find a signal of interest hidden in a long data record, and measure delays between signals to synchronize them. Compute the response of a linear time-invariant (LTI) system to an input signal, perform polynomial multiplication, and carry out circular convolution.

## Functions

expand all

 `corrcoef` Correlation coefficients `corrmtx` Data matrix for autocorrelation matrix estimation `xcorr` Cross-correlation `xcorr2` 2-D cross-correlation `xcov ` Cross-covariance
 `cconv` Modulo-n circular convolution `conv` Convolution and polynomial multiplication `conv2` 2-D convolution `convmtx` Convolution matrix `cov` Covariance `deconv` Deconvolution and polynomial division
 `alignsignals` Align two signals by delaying earliest signal `dtw` Distance between signals using dynamic time warping `edr` Edit distance on real signals `finddelay` Estimate delay(s) between signals `findsignal` Find signal location using similarity search

## Topics

### Common Applications

Find a Signal in a Measurement

Determine if a signal matches a segment of a noisy longer stream of data.

Align Two Simple Signals

Learn to align signals of different lengths using cross-correlation.

Align Signals with Different Start Times

Synchronize data collected by different sensors at different instants.

Align Signals Using Cross-Correlation

Use cross-correlation to fuse asynchronous data.

Find Periodicity Using Autocorrelation

Verify the presence of cycles in a noisy signal, and determine their durations.

Echo Cancelation

Use autocorrelation to filter out an echo from a speech recording.

### Autocorrelation and Cross-Correlation

Cross-Correlation with Multichannel Input

Compute autocorrelations and cross-correlations of a multichannel signal.

Confidence Intervals for Sample Autocorrelation

Create confidence intervals for the autocorrelation sequence of a white noise process.

Autocorrelation Function of Exponential Sequence

Compute the autocorrelation of an exponential sequence and compare it to the analytic result.

Cross-Correlation of Two Exponential Sequences

Compute the cross-correlation of two exponential sequences and compare it to the analytic result.

Autocorrelation of Moving Average Process

Use filtering to introduce autocorrelation into a white noise process.

Cross-Correlation of Two Moving Average Processes

Find and plot the cross-correlation sequence between two moving average processes.

Cross-Correlation of Delayed Signal in Noise

Use the cross-correlation sequence to detect the time delay in a noise-corrupted sequence.

Cross-Correlation of Phase-Lagged Sine Wave

Use the cross-correlation sequence to estimate the phase lag between two sine waves.

Linear and Circular Convolution

Establish an equivalence between linear and circular convolution.