Assignment 8; 10 points
Two time series are given by Xt=[1, 9, 2, 1, 4], Yt=[2, -5, 3, 8, 1]. Calculate the cross-, auto- correlations, and the correlation coefficient. You may use Matlab for the calculations. Explain your results.
Note:
Study Lecture 19 xcorr – cross correlation in Matlab corrcoef – correlation coefficient in Matalb
Geophys 6001: Advanced Geophysical Data Analysis
Assignment 8; 10 points
Two time series are given by Xt=[1, 9, 2, 1, 4], Yt=[2, -5, 3, 8, 1]. Calculate the
cross-, auto- correlations, and the correlation coefficient. You may use Matlab for
the calculations. Explain your results.
Note:
Study Lecture 19
xcorr – cross correlation in Matlab
corrcoef – correlation coefficient in Matalb
GEOPHYS 6001
Advanced Geophysical Data Analysis
Contents
Lecture 19
Cross correlation
Kelly Liu
Auto correlation
Correlation coefficient
Convolutional Neural Network
References: Yilmaz, “Seismic data analysis”
Kearey et al., “An introduction to geophysical exploration”
Liu’s Geophys 6001, Summer 2020
1
Cross-correlation
In data analysis, it often requires measurement of the similarity or time
alignment of two traces.
Correlation is another time-domain operation that is used to make such
measurements.
φab (τ ) = ∑ ak bk +τ
k
Liu’s Geophys 6001, Summer 2020
2
Cross-correlation
Exercise 1:
φab (τ ) = ∑ ak bk +τ
φab (τ ) =k∑ ak bk +τ
a={1,2,3,2,1}
b={1,-1,1,-1,2}
Xcorrelation of a with b
∴φab (0) = ∑ akk bk = a0b0 + a1b1 + a2b2 + a3b3 + a4b4 + a5b5 = 1 − 2 + 3 − 2 + 2 = 2
φab (1) = ∑ ak bk +1 = a0b1 + a1b2 + a2b3 + a3b4 = −1 + 2 − 3 + 4 = 2
φab (2) = ∑ ak bk + 2 = a0b2 + a1b3 + a2b4 = 1 − 2 + 6 = 5
φab (3) = ∑ ak bk +3 = a0b3 + a1b4 = −1 + 4 = 3
φab (4) = ∑ ak bk + 4 = a0b4 = 2
-2, -1, 0, 1, 2, 3, 4
= a-3
φab (−1) = ∑ ak bk −1-4,
1b0 + a2 b1 + a3b2 + a4 b3 = 2 − 3 + 2 − 1 = 0
φab (−2) = ∑ ak bk − 2 = a2b0 + a3b1 + a4b2 = 3 − 2 + 1 = 2
φab (−3) = ∑ ak bk −3 = a3b0 + a4b1 = 2 − 1 = 1
φab (−4) = ∑ ak bk − 4 = a4b0 = 1
φab (τ ) = {1,1,2,0,2,2,5,3,2}
Liu’s Geophys 6001, Summer 2020
3
Cross-correlation
Exercise 1:
φab (τ ) = ∑ ak bk +τ
a={1,2,3,2,1}
b={1,-1,1,-1,2}
Xcorrelation of a with b
k
∴φab (0) = ∑ ak bk = a0b0 + a1b1 + a2b2 + a3b3 + a4b4 + a5b5 = 1 − 2 + 3 − 2 + 2 = 2
φab (1) = ∑ ak bk +1 = a0b1 + a1b2 + a2b3 + a3b4 = −1 + 2 − 3 + 4 = 2
φab (2) = ∑ ak bk + 2 = a0b2 + a1b3 + a2b4 = 1 − 2 + 6 = 5
φab (3) = ∑ ak bk +3 = a0b3 + a1b4 = −1 + 4 = 3
φab (4) = ∑ ak bk + 4 = a0b4 = 2
φab (−1) = ∑ ak bk −1 = a1b0 + a2b1 + a3b2 + a4b3 = 2 − 3 + 2 − 1 = 0
φab (−2) = ∑ ak bk − 2 = a2b0 + a3b1 + a4b2 = 3 − 2 + 1 = 2
φab (−3) = ∑ ak bk −3 = a3b0 + a4b1 = 2 − 1 = 1
φab (−4) = ∑ ak bk − 4 = a4b0 = 1
φab (τ ) = {1,1,2,0,2,2,5,3,2}
Length: 5+5-1=9
Compare with convolution, correlation don’t need to reverse the second sequence.
Liu’s Geophys 6001, Summer 2020
4
Auto-correlation
φaa (τ ) = ∑ ak ak +τ
k
Liu’s Geophys 6001, Summer 2020
5
Cross-correlation
Exercise 2:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Xcorrelation of w1 with w2
Two wavelets are identical in shape, wavelet 2 is
shifted by two samples with respect to wavelet 1.
Liu’s Geophys 6001, Summer 2020
6
Cross-correlation
Exercise 2:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Xcorrelation of w1 with w2
It measures how much two time series resemble each other.
If wavelet 2 were shifted two samples back in time, then
these two wavelets would have the maximum similarity.
Liu’s Geophys 6001, Summer 2020
7
Cross-correlation
Exercise 3:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Xcorrelation of w2 with w1
Liu’s Geophys 6001, Summer 2020
8
Cross-correlation
Exercise 3:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Xcorrelation of w2 with w1
If wavelet 1 were shifted by two samples forward in time,
these two wavelets would have maximum similarity.
Liu’s Geophys 6001, Summer 2020
9
Cross-correlation
φ ab (τ ) = φba (−τ )
Unlike convolution, cross correlation is not commutative
—the output depends on which array is fixed and which is moved.
Liu’s Geophys 6001, Summer 2020
10
Auto-correlation
Exercise 4:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Autocorrelation of W1
Liu’s Geophys 6001, Summer 2020
11
Auto-correlation
Exercise 4:
Wavelet 1: (2,-1,1,0,0)
Wavelet 2: (0,0,2,-1,1)
Autocorrelation of W1
Maximum correlation occurs at zero lag.
The autocorrelation function is symmetric.
Only one side of the autocorrelation needs to be computed.
Liu’s Geophys 6001, Summer 2020
12
Convolution
&
Correlation
Correlation is a
convolution without
reversing the moving
array.
Fig. 1.1-19. The frequency-domain description of convolution and correlation.
Liu’s Geophys 6001, Summer 2020
13
Convolution
&
Correlation
Convolution
Y=|Y|e iφy
=|X1|.|X2| ei(φx1+φx2)
Corss-Correlation
Y=|Y|e iφy
=|X1|.|X2| ei(φx1-φx2)
Fig. 1.1-19. The frequency-domain description of convolution and correlation.
Liu’s Geophys 6001, Summer 2020
14
Convolution & Correlation
Both convolution and correlation produce an output with a spectral bandwidth that
is common to both the input time series. The immediate example is the band-pass
filtering process.
Phases are additive in case of convolution and subtractive in case of correlation.
Liu’s Geophys 6001, Summer 2020
15
Convolution & Correlation
Auto-correlation is symmetric with respect to zero lag. The output series is
zero-phase.
The autocorrelation function contains all the amplitude information of the
original waveform but none of the phase information. The original phase
relationships being replaced by a zero phase spectrum.
The autocorrelation function and the power spectrum form a Fourier pair.
φ xx (τ ) < − > x( f )
2
Power spectrum
Liu’s Geophys 6001, Summer 2020
16
Cross-correlation
As a measure of similarity, cross-correlation has been used widely at various
stages of data processing.
For instance,
Traces in a CMP gather are cross correlated with a pilot trace to compute
residual statics shifts.
The fundamental basis for computing velocity spectra is cross correlation.
The constituent elements of the Wiener filter are cross correlation of the
desired output waveform with the input wavelet, and autocorrelation of the
input wavelet.
Liu’s Geophys 6001, Summer 2020
17
Auto-correlation
Sketch the auto correlation
Liu’s Geophys 6001, Summer 2020
18
Haton et al., “Seismic Data Processing”
Autocorrelation
Liu’s Geophys 6001, Summer 2020
19
Haton et al., “Seismic Data Processing”
Auto-correlation
+
Liu’s Geophys 6001, Summer 2020
20
Haton et al., “Seismic Data Processing”
Auto-correlation
+
Liu’s Geophys 6001, Summer 2020
21
Haton et al., “Seismic Data Processing”
Cross-correlation
Liu’s Geophys 6001, Summer 2020
22
Haton et al., “Seismic Data Processing”
Crosscorrelation
Liu’s Geophys 6001, Summer 2020
23
Haton et al., “Seismic Data Processing”
Autocorrelation
Liu’s Geophys 6001, Summer 2020
24
Haton et al., “Seismic Data Processing”
Autocorrelation
Liu’s Geophys 6001, Summer 2020
25
Haton et al., “Seismic Data Processing”
Correlation Coefficient
Or Linear correlation coefficient
∑ ( x − x )( y
γ=
i
i
i
− y)
∑ (x − x) ∑ ( y
i
x
y
2
i
i
.
Note that
i
− y)
2
| γ |≤ 1
Is the mean of X
Is the mean of Y
γ =1
γ = −1
means complete positive correlation.
means complete negative correlation.
Numerical recipes in Fortran 77; P630
Liu’s Geophys 6001, Summer 2020
26
Correlation Coefficient
Liu’s Geophys 6001, Summer 2020
27
http://www.okstate.edu/artsci/botany/bisc3034/lnotes/corr.jpg
Cross-correlation
Sweep signal
Liu’s Geophys 6001, Summer 2020
28
Robinson and Coruh, “Basic Exploration Geophysics”
Cross-correlation
Correlogram
Normally, a correlogram is a plot of the sample autocorrelations versus the time lags.
Liu’s Geophys 6001, Summer 2020
29
Kearey et al., An introduction to Geophysical Exploration
Cross-correlation
Liu’s Geophys 6001, Summer 2020
30
CNN
Convolutional Neural Network
The convolution is performed on the input data with the use of a filter to
produce a feature map.
In the convolution operation, the filter (the
green square) is sliding over the input (the
blue square) and the sum of the
convolution goes into the feature map (the
red square).
2D convolution. Good for image processing.
Convolution or cross-correlation?
= cross-correlation.
https://www.freecodecamp.org/news/an-intuitive-guide-to-convolutional-neural-networks-260c2de0a050/
Liu’s Geophys 6001, Summer 2020
31
Summary
Cross correlation
Auto correlation
Correlation coefficient
Convolutional Neural Network
Liu’s Geophys 6001, Summer 2020
32