DADiSP Worksheet Functions > Function Categories > Fourier Transforms and Signal Processing > CROSSCOR

 

CROSSCOR

Purpose:

Macro. Performs a time domain cross-correlation of a series.

Syntax:

CROSSCOR(series1, series2)

series1

-

A series.

series2

-

A series.

Returns:

A table or series.

Expansion:

CONV(S1,REVERSE(S2)/(SERSIZE(S1)+SERSIZE(S2))

Example:

W1: gsin(128, 1/128, 4.0)

W2: gsin(128, 1/128, 4.0)

W3: crosscor(W1, W2)

 

performs a cross-correlation of two sine waves.

Example:

W1: grand(128, 1/128)

W2: gsin(128, 1/128, 4.0)

W3: crosscor(W1, W2)

 

performs the cross-correlation of a sine wave with a random series.

Remarks:

CROSSCOR calculates the cross-correlation directly in the time domain via convolution without normalization. Use XCORR for a time domain version that supports normalization and FXCORR for a frequency domain implementation.

 

The cross-correlation function is often used to indicate how "similar" one waveform is to another. The cross-correlation of the above sine waves returns a waveform with several distinct peaks, indicating that the two series are very similar at each point in time where the peaks occur.

 

The cross-correlation of the random series with the sine wave results in a waveform with some peaks, but the amplitude of the waveform is considerably reduced (try OVERPLOT), indicating that the two input series are very dissimilar.

See Also:

AUTOCOR

CONV

FFT

FXCORR

PEARSON

XCORR