R: Phase Lag

getphaselag2 {RSEIS} | R Documentation

## 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

### Details

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

### Value

phase lag, seconds

### Author(s)

Jonathan M. Lees<jonathan.lees.edu>

### See Also

mtapspec

### Examples

    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)

[Package RSEIS version 3.7-4 Index]