# Calculating crosscorrelation and autocorrelation

Series Geophysical References Series Problems in Exploration Seismology and their Solutions Lloyd P. Geldart and Robert E. Sheriff 9 295 - 366 http://dx.doi.org/10.1190/1.9781560801733 ISBN 9781560801153 SEG Online Store

## Problem

Four causal wavelets are given by $a_{t}=[2,\;-1]$ , $b_{t}=[4,1]$ , $c_{t}=[6,\;-7,\;2]$ , $d_{t}=[4,9,2]$ . Calculate the crosscorrelations and autocorrelations $\phi _{ab}$ , $\phi _{ac}$ , $\phi _{ca}$ , $\phi _{aa}$ , and $\phi _{cc}$ in both the time and frequency domains.

### Background

A causal wavelet as defined in problem 5.21 has zero values when $t<0$ .

The crosscorrelation $\phi _{gh}(\tau )$ of $g_{t}$ and $h_{t}$ tells us how similar the two functions are when $h_{t}$ is shifted the amount $\tau$ relative to $g_{t}$ . The crosscorrelation is given by the equation

 {\begin{aligned}\phi _{gh}(\tau )=\sum \limits _{k}^{}g_{k}h_{k+\tau }.\end{aligned}} (9.8a)

This equation means that $h_{t}$ is displaced $\tau$ units to the left relative to $g_{t}$ , corresponding values multiplied, and the products summed to give $\phi _{gh}(\tau )$ . The result is the same if we move $g_{t}$ to the right $\tau$ units, that is,

 {\begin{aligned}\phi _{gh}(\tau )=\phi _{hg}(-\tau ).\end{aligned}} (9.8b)

The functions $\phi _{gh}(\tau )$ and $g_{t}*h_{t}$ are closely related. Using two simple curves, it is easily shown that we can crosscorrelate by reversing $g_{t}$ and convolving the reversed function with $h_{t}$ , that is,

 {\begin{aligned}\phi _{gh}(\tau )=g_{-\tau }*h_{\tau }=g_{\tau }*h_{-\tau }\end{aligned}} (9.8c)

(since convolution is commutative). Reversing a function in time changes the sign of $t=n\Delta$ , so the exponent of $z$ changes sign also, $z$ becoming $z^{-1}$ and $G(z)$ becoming the conjugate complex ${\bar {G}}(z)$ . The convolution theorem (equation (9.3f)) now becomes the crosscorrelation theorem:

 {\begin{aligned}\phi _{gh}(\tau )\leftrightarrow {\bar {G}}(z)H(z).\end{aligned}} (9.8d)

If $h_{t}$ is the same as $g_{t}$ , we get the autocorrelation of $g_{t}$ and equations (9.8a,d) become

 {\begin{aligned}\phi _{gg}(\tau )=\sum \limits _{k}^{}g_{k}\ g_{k+\tau }\leftrightarrow |G(z)|^{2},\end{aligned}} (9.8e)

the transform relation being the autocorrelation theorem. Since the two functions are the same, $\phi _{gg}(\tau )$ does not depend upon the direction of displacement. The autocorrelation for $\tau =0$ equals the sum of the data elements squared, hence is called the energy of the trace;

 {\begin{aligned}\phi _{gg}(0)=\sum \limits _{k}^{}g_{k}^{2}.\end{aligned}} (9.8f)

Both the autocorrelation and the crosscorrelation are often normalized; in the case of the autocorrelation, equation (9.8e) becomes

 {\begin{aligned}\phi _{gg}(\tau )_{\mathrm {norm} }=\left(\sum \limits _{k}^{}g_{k}\ g_{k+\tau }\right)\left(\sum \limits _{k}^{}g_{k}^{2}\right)^{-1}=\phi _{gg}(\tau )/\phi _{gg}(0).\end{aligned}} (9.8g)

The normalized crosscorrelation is

 {\begin{aligned}\phi _{gh}(\tau )_{\mathrm {norm} }=\phi _{gh}(\tau )/[\phi _{gg}(0)\phi _{hh}(0)]^{1/2}.\end{aligned}} (9.8h)

### Solution

Time-domain calculations:

Using equation (9.8a) to calculate $\phi _{ab}$ , i.e., $b_{t}$ is first shifted to the left; we have:

{\begin{aligned}\phi _{ab}(+1)=2\times 1=2;\quad \phi _{ab}(0)=2\times 4-1\times 1=7;\quad \phi _{ab}(-1)=-1\times 4=-4.\end{aligned}} So

{\begin{aligned}\phi _{ab}(\tau )=[-4,\mathop {7} \limits ^{\downarrow },\;2],\end{aligned}} where $\downarrow$ marks the value at $\tau =0$ . Proceeding in the same way, we find that

{\begin{aligned}&\phi _{ac}(+2)=4,\quad \phi _{ac}(+1)=-16,\quad \phi _{ac}(0)=19,\quad \phi _{ac}(-1)=-6;\\&\phi _{ac}(\tau )=[-6,\mathop {19} \limits ^{\downarrow },-16,4].\end{aligned}} To find $\phi _{ca}(\tau )$ we displace $a_{t}$ instead of $c_{t}$ and obtain $\phi _{ca}=[4,\;-16,\;\mathop {19} \limits ^{\downarrow },\;-6]$ , which equals $\phi _{ac}(-\tau )$ .

Autocorrelations are found in the same way:

{\begin{aligned}\phi _{aa}(\tau )=[-2,\;\mathop {5} \limits ^{\downarrow },\;-2];\quad \phi _{cc}=[12,\;-56,\;\mathop {89} \limits ^{\downarrow },\;-56,\;12].\end{aligned}} Frequency-domain calculations

The $z$ -transforms of $a_{t}$ , $b_{t}$ , and $c_{t}$ are $A(z)=(2-z)$ , $B(z)=(4+z)$ , $C(z)=(6-7z+2z^{2})$ . The conjugate complexes of these transforms are are $A(z)=(2-z^{-1})$ , $B(z)=(4+z^{-1})$ , $C(z)=(6-7z^{-1}+2z^{-2})$ . Using these transforms, we get

{\begin{aligned}&\phi _{ab}(\tau )\leftrightarrow {\bar {A}}(z)B(z)=(2-z^{-1}(4+z)\\&=-4z^{-1}+7+2z\leftrightarrow [-4,\;\mathop {7} \limits ^{\downarrow },\;2];\\&\phi _{ac}(\tau )\leftrightarrow {\bar {A}}(z)C(z)=(2-z^{-1})(6-7z+z^{2})\\&=-6z^{-1}+19-16z+4z^{2}\leftrightarrow [-6,\;\mathop {19} \limits ^{\downarrow },\;-16+4];\\&\phi _{ca}(\tau )\leftrightarrow {\bar {C}}(z)A(z)=(2z^{-2}-7z^{-1}+6)(2-z)\\&=4z^{-2}-16z^{-1}+19-6z\leftrightarrow [4,\;-16,\;\mathop {19} \limits ^{\downarrow },\;-6];\\&\phi _{aa}(\tau )\leftrightarrow (2-z^{-1})(2-z)=-2z^{-1}+5-2z\leftrightarrow [-2,\;\mathop {5} \limits ^{\downarrow },\;-2];\\&\phi _{cc}(\tau )\leftrightarrow (6-7z^{-1}+2z^{-2})(6-7z+2z^{2})\\&=12z^{-2}-56z^{-1}+89-56z+12z^{2}\leftrightarrow [12,\;-56,\;\mathop {89} \limits ^{\downarrow },\;-56,\;12].\end{aligned}} 