Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿

### IMSL_CORR1D

IMSL_CORR1D

The IMSL_CORR1D function computes the discrete correlation of two one-dimensional arrays.

The IMSL_CORR1D function computes the discrete correlation of two sequences x and y. If only one argument is passed, then IMSL_CORR1D computes the discrete correlation of x and x.

More precisely, let n be the length of x and y. If PERIODIC is set, then nz = n, otherwise nz is set to the smallest whole number, nz2n – 1, of the form: The arrays x and y are then zero-padded to a length nz. Then, we compute: where the index on x is interpreted as a positive number between 0 and nz – 1.

The technique used to compute the zi’s is based on the fact that the (complex discrete) Fourier transform maps correlation into multiplication. Thus, the Fourier transform of z is given by: where the following equation is true: Thus, the technique used here to compute the correlation is to take the discrete Fourier transform of x and the conjugate of the discrete Fourier transform of y, multiply the results together component-wise, and then take the inverse transform of this product. It is very important to make sure that nz is the product of small primes if the keyword PERIODIC is selected. If nz is the product of small primes, then the

computational effort will be proportional to nzlog (nz). If PERIODIC is not set, then a good value is chosen for nz so that the Fourier transforms are efficient and nz ≥ 2n – 1. This will mean that both vectors may be padded with zeros.

If x and y are not complex, then no complex transforms of x or y are taken, since a real transforms can simulate the complex transform above. Such a strategy is six times faster and requires less space than when using the complex transform.

## Example

This example computes a periodic correlation between two distinct signals x and y. We have 100 equally spaced points on the interval [0, 2π] and f1 (x) = sin (x). We define x and y as follows: Note that the maximum value of z (the correlation of x with y) occurs at i = 25, which corresponds to the offset.

`n = 100`
`t = 2*!DPI*FINDGEN(n)/(n-1)`
`x = SIN(t)`
`y = SIN(t+!dpi/2)`
` `
`; Define the signals and compute the norms of the signals. `
`xnorm = IMSL_NORM(x)`
`ynorm = IMSL_NORM(y)`
`z = IMSL_CORR1D(x, y, /Periodic)/(xnorm*ynorm)`
` `
`; Compute periodic correlation, and find the largest normalized`
`; element of the result.`
`max_z = (SORT(z))(N_ELEMENTS(z)-1) `
`PRINT, max_z, z(max_z)`

IDL prints:

`25	1.00`

## Syntax

Result = IMSL_CORR1D(x[, y] [, PERIODIC=value])

## Return Value

A one-dimensional array containing the discrete convolution of x and x, or x and y if y is supplied.

## Arguments

### x

One-dimensional array.

### y (optional)

One-dimensional array.

## Keywords

### PERIODIC (optional)

If present and nonzero, then a circular convolution is computed.

## Version History

 6.4 Introduced

© 2020 Harris Geospatial Solutions, Inc. |  Legal