Learn R Programming

RSEIS (version 2.1-6)

getphaselag2: Phase Lag

Description

Use MTM spectrum to estimate phase lag between two signals.

Usage

getphaselag2(y1, y2, DT = 0.008, frange = c(0, 20), PLOT = FALSE, PLOT1 = FALSE, PLOT2 = FALSE)

Arguments

y1
vector times series one
y2
vector times series two
DT
deltaT sample rate, s
frange
vector, frequency bounds for analysis
PLOT
logical, TRUE=diagnostic plot
PLOT1
logical, TRUE=diagnostic plot
PLOT2
logical, TRUE=diagnostic plot

Value

  • phase lag, seconds

Details

uses the slope of the cross spectrum to estimate the phase lag.

See Also

mtapspec

Examples

Run this code
data("GH")

Xamp1=GH$JSTR[[1]]
Xamp1=Xamp1[1123:2000]

Xamp2= GH$JSTR[[4]]
Xamp2=Xamp2[1123:2000]
plot(Xamp1,type='l')
lines(Xamp2,type='l',col='red')

 pshift = getphaselag2(Xamp1, Xamp2,  DT=GH$info$dt[1],  frange=c(5, 15),  PLOT=TRUE)

Run the code above in your browser using DataLab