hilbertFFT: Hilbert FFT

View source: R/spectralUtils.R

hilbertFFTR Documentation

Hilbert FFT

Description

The hilbertFFT function returns the complex Hilbert FFT of a timeseries signal.

Usage

hilbertFFT(x)

Arguments

x

a numeric vector

Details

This function is intended for internal use by the hilbert() and envelope() methods of Trace objects.

Value

A complex vector containing the Hilbert FFT of x.

Note

This algorithm is adapted from code in the seewave package.

Author(s)

Jonathan Callahan jonathan@mazamascience.com

Examples

## Not run: 
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

starttime <- as.POSIXct("2010-02-27 06:00:00", tz="GMT")
endtime <- as.POSIXct("2010-02-27 09:00:00", tz="GMT")

# Get the waveform
st <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime)
tr <- st@traces[[1]]

# Demean, detrend, cosine taper
tr <- DDT(tr)

# Calculate Hilbert FFT of the trace data
hfft <- hilbertFFT(tr@data)

# Plot signal, with Hilbert envelope
layout(1)
plot(tr@data, type='l', col='gray80', main="Signal and Envelope")
points(Mod(hfft), type='l', col='blue')

# 2 rows
layout(matrix(seq(2)))

# Show that Imaginary component of Hilbert transform has the
# original signal shifted by 90 degrees
ccf(tr@data,tr@data,lag.max=200,main="Auto-correlation of signal data")
ccf(tr@data,Im(hfft),lag.max=200,main="90 deg phase shift with Hilber transform")

# Restore default layout
layout(1)

## End(Not run)

IRISSeismic documentation built on Oct. 16, 2022, 1:09 a.m.