Environmental Data Analysis with MatLab
-
Upload
anouar-attn -
Category
Documents
-
view
38 -
download
6
description
Transcript of Environmental Data Analysis with MatLab
![Page 1: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/1.jpg)
Environmental Data Analysis with MatLab
Lecture 18:
Cross-correlation
![Page 2: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/2.jpg)
Lecture 01 Using MatLabLecture 02 Looking At DataLecture 03 Probability and Measurement Error Lecture 04 Multivariate DistributionsLecture 05 Linear ModelsLecture 06 The Principle of Least SquaresLecture 07 Prior InformationLecture 08 Solving Generalized Least Squares ProblemsLecture 09 Fourier SeriesLecture 10 Complex Fourier SeriesLecture 11 Lessons Learned from the Fourier TransformLecture 12 Power Spectral DensityLecture 13 Filter Theory Lecture 14 Applications of Filters Lecture 15 Factor Analysis Lecture 16 Orthogonal functions Lecture 17 Covariance and AutocorrelationLecture 18 Cross-correlationLecture 19 Smoothing, Correlation and SpectraLecture 20 Coherence; Tapering and Spectral Analysis Lecture 21 InterpolationLecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-TestsLecture 24 Confidence Limits of Spectra, Bootstraps
SYLLABUS
![Page 3: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/3.jpg)
purpose of the lecture
generalize the idea of autocorrelation
to multiple time series
![Page 4: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/4.jpg)
Review of last lecture
autocorrelationcorrelations between samples within a
time series
![Page 5: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/5.jpg)
high degree of short-term correlation
what ever the river was doing yesterday, its probably doing today, too
because water takes time to drain away
![Page 6: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/6.jpg)
0 500 1000 1500 2000 2500 3000 3500 40000
1
2
x 104
time, days
disc
harg
e, c
fs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.050
2
4
6
8
x 109
frequency, cycles per dayPS
D,
(cfs
)2 per
cyc
le/d
ay
A) time series, d(t)
time t, days
d(t)
, cfs
Neuse River Hydrograph
![Page 7: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/7.jpg)
low degree of intermediate-term correlation
what ever the river was doing last month, today it could be doing something completely different
because storms are so unpredictable
![Page 8: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/8.jpg)
0 500 1000 1500 2000 2500 3000 3500 40000
1
2
x 104
time, days
disc
harg
e, c
fs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.050
2
4
6
8
x 109
frequency, cycles per dayPS
D,
(cfs
)2 per
cyc
le/d
ay
A) time series, d(t)
time t, days
d(t)
, cfs
Neuse River Hydrograph
![Page 9: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/9.jpg)
moderate degree of long-term correlation
what ever the river was doing this time last year, its probably doing today, too
because seasons repeat
![Page 10: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/10.jpg)
0 500 1000 1500 2000 2500 3000 3500 40000
1
2
x 104
time, days
disc
harg
e, c
fs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.050
2
4
6
8
x 109
frequency, cycles per dayPS
D,
(cfs
)2 per
cyc
le/d
ay
A) time series, d(t)
time t, days
d(t)
, cfs
Neuse River Hydrograph
![Page 11: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/11.jpg)
0 0.5 1 1.5 2 2.5
x 104
0
0.5
1
1.5
2
2.5x 10
4
discharge
disc
harg
e la
gged
by
1 da
ys
0 0.5 1 1.5 2 2.5
x 104
0
0.5
1
1.5
2
2.5x 10
4
discharge
disc
harg
e la
gged
by
3 da
ys
0 0.5 1 1.5 2 2.5
x 104
0
0.5
1
1.5
2
2.5x 10
4
discharge
disc
harg
e la
gged
by
30 d
ays
1 day 3 days 30 days
![Page 12: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/12.jpg)
-30 -20 -10 0 10 20 300
5
x 106
lag, days
auto
corr
elat
ion
-3000 -2000 -1000 0 1000 2000 3000
-505
x 106
lag, days
auto
corr
elat
ion
Autocorrelation Function
31 30
![Page 13: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/13.jpg)
formula for covariance
![Page 14: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/14.jpg)
formula for autocorrelation
autocorrelationat lag (k-1)Δt
![Page 15: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/15.jpg)
autocorrelation similar to convolution
![Page 16: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/16.jpg)
autocorrelation similar to convolution
note difference in sign
![Page 17: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/17.jpg)
autocorrelation in MatLab
![Page 18: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/18.jpg)
Important Relation #1autocorrelation is the convolution of a time series with its time-reversed self
![Page 19: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/19.jpg)
Important Relationship #2Fourier Transform of an autocorrelation
is proportional to thePower Spectral Density of time series
![Page 20: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/20.jpg)
End of Review
![Page 21: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/21.jpg)
Part 1
correlations between time-series
![Page 22: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/22.jpg)
scenario
discharge correlated with rain
but discharge is delayed behind rain
because rain takes time to drain from the land
![Page 23: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/23.jpg)
time, days
time, days
rain
, mm
/day
disc
hagr
e, m
3 /s
![Page 24: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/24.jpg)
time, days
time, days
rain
, mm
/day
disc
hagr
e, m
3 /s
rain ahead ofdischarge
![Page 25: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/25.jpg)
time, days
time, days
rain
, mm
/day
disc
hagr
e, m
3 /s
shape not exactly the same, either
![Page 26: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/26.jpg)
treat two time series u and v probabilistically
p.d.f. p(ui, vi+k-1)with elements lagged by time(k-1)Δtand compute its covariance
![Page 27: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/27.jpg)
this defines the cross-correlation
![Page 28: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/28.jpg)
just a generalization of the auto-correlation
different times in the same time series
different times in different time series
![Page 29: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/29.jpg)
like autocorrelation, similar to convolution
![Page 30: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/30.jpg)
As with auto-correlationtwo important properties
#1: relationship to convolution
#2: relationship to Fourier Transform
![Page 31: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/31.jpg)
As with auto-correlationtwo important properties
#1: relationship to convolution
#2: relationship to Fourier Transform
cross-spectral density
![Page 32: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/32.jpg)
cross-correlation in MatLab
![Page 33: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/33.jpg)
Part 2
aligning time-seriesa simple application of cross-correlation
![Page 34: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/34.jpg)
central idea
two time series are best alignedat the lag at which they are most correlated,
which is
the lag at which their cross-correlation is maximum
![Page 35: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/35.jpg)
10 20 30 40 50 60 70 80 90 100-1
0
1
10 20 30 40 50 60 70 80 90 100-1
0
1
u(t)
v(t)
two similar time-series, with a time shift
(this is simple “test” or “synthetic” dataset)
![Page 36: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/36.jpg)
-20 -10 0 10 20
-5
0
5
time
cros
s-co
rrel
atio
n
cross-correlate
![Page 37: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/37.jpg)
-20 -10 0 10 20
-5
0
5
time
cros
s-co
rrel
atio
n
maximum
time lag
find maximum
![Page 38: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/38.jpg)
In MatLab
![Page 39: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/39.jpg)
In MatLab
compute cross-correlation
![Page 40: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/40.jpg)
In MatLab
compute cross-correlation
find maximum
![Page 41: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/41.jpg)
In MatLab
compute cross-correlation
find maximum
compute time lag
![Page 42: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/42.jpg)
10 20 30 40 50 60 70 80 90 100-1
0
1
10 20 30 40 50 60 70 80 90 100-1
0
1
u(t)
v(t+tlag)
align time series with measured lag
![Page 43: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/43.jpg)
A)
B)
2 4 6 8 10 12 140
500
time, days
solar
, W/m
2
2 4 6 8 10 12 140
50
100
time, days
ozon
e, p
pb
2 4 6 8 10 12 140
500
time, days
solar
, W/m
2
2 4 6 8 10 12 140
50
100
time, days
ozon
e, p
pbsolar insolation and ground level ozone(this is a real dataset from West Point NY)
![Page 44: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/44.jpg)
B)
2 4 6 8 10 12 140
500
time, days
solar
, W/m
2
2 4 6 8 10 12 140
50
100
time, days
ozon
e, p
pb
2 4 6 8 10 12 140
500
time, days
solar
, W/m
2
2 4 6 8 10 12 140
50
100
time, days
ozon
e, p
pbsolar insolation and ground level ozone
note time lag
![Page 45: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/45.jpg)
-10 -5 0 5 100
1
2
3
4x 10
6
time, hours
cros
s-co
rrel
atio
n
C)maximum
time lag3 hours
![Page 46: Environmental Data Analysis with MatLab](https://reader031.fdocuments.us/reader031/viewer/2022020117/55cf992b550346d0339bf7cb/html5/thumbnails/46.jpg)
0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
500
time, days
sola
r rad
iatio
n, W
/m2
0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
50
100
3.00 hour lag
time, days
ozon
e, p
pb
A)
B) originaldelagged