# 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 ${\displaystyle a_{t}=[2,\;-1]}$, ${\displaystyle b_{t}=[4,1]}$, ${\displaystyle c_{t}=[6,\;-7,\;2]}$, ${\displaystyle d_{t}=[4,9,2]}$. Calculate the crosscorrelations and autocorrelations ${\displaystyle \phi _{ab}}$, ${\displaystyle \phi _{ac}}$, ${\displaystyle \phi _{ca}}$, ${\displaystyle \phi _{aa}}$, and ${\displaystyle \phi _{cc}}$ in both the time and frequency domains.

### Background

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

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

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

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

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

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

 {\displaystyle {\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 ${\displaystyle t=n\Delta }$, so the exponent of ${\displaystyle z}$ changes sign also, ${\displaystyle z}$ becoming ${\displaystyle z^{-1}}$ and ${\displaystyle G(z)}$ becoming the conjugate complex ${\displaystyle {\bar {G}}(z)}$. The convolution theorem (equation (9.3f)) now becomes the crosscorrelation theorem:

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

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

 {\displaystyle {\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, ${\displaystyle \phi _{gg}(\tau )}$ does not depend upon the direction of displacement. The autocorrelation for ${\displaystyle \tau =0}$ equals the sum of the data elements squared, hence is called the energy of the trace;

 {\displaystyle {\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

 {\displaystyle {\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

 {\displaystyle {\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 ${\displaystyle \phi _{ab}}$, i.e., ${\displaystyle b_{t}}$ is first shifted to the left; we have:

{\displaystyle {\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

{\displaystyle {\begin{aligned}\phi _{ab}(\tau )=[-4,\mathop {7} \limits ^{\downarrow },\;2],\end{aligned}}}

where ${\displaystyle \downarrow }$ marks the value at ${\displaystyle \tau =0}$. Proceeding in the same way, we find that

{\displaystyle {\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 ${\displaystyle \phi _{ca}(\tau )}$ we displace ${\displaystyle a_{t}}$ instead of ${\displaystyle c_{t}}$ and obtain ${\displaystyle \phi _{ca}=[4,\;-16,\;\mathop {19} \limits ^{\downarrow },\;-6]}$, which equals ${\displaystyle \phi _{ac}(-\tau )}$.

Autocorrelations are found in the same way:

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

{\displaystyle {\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}}}