dropFreqs: Truncate mtm or mtm.coh Objects in Frequency

View source: R/dropFreqs.R

dropFreqsR Documentation

Truncate mtm or mtm.coh Objects in Frequency

Description

A utility function to truncate the frequencies in a spectral estimate. This utility is used before calling plot(), to increase the visual frequency resolution of a plot by truncating frequencies outside a particular band of interest. This function is not a filter, but rather a utility to allow R to 'zoom' a spectrum plot to a certain frequency band.

Usage

dropFreqs(spec, minFreq, maxFreq)

Arguments

spec

A spectrum object 'obj', of class spec, mtm, or mtm.coh.

minFreq

The lower bound for the frequency band to be retained, in the same units as the obj$freq array.

maxFreq

The upper bound for the frequency band to be retained, also in the same units as the obj$freq array.

Examples

data(willamette)
mtm1 <- spec.mtm(willamette, nw=4.0, k=8, plot=FALSE, deltat=1.0, dtUnits="month")
mtm2 <- dropFreqs(mtm1, 0.1, 0.4)
plot(mtm2)

# another option
plot(dropFreqs(mtm1, 0.1, 0.4))

# using sine tapers
mtm.sine <- spec.mtm(willamette, k=10, plot=FALSE, deltat=1.0, dtUnits="month", 
                     taper="sine", sineAdaptive=FALSE, sineSmoothFact=0.05)
plot(dropFreqs(mtm.sine, 0.1, 0.4))                     

krahim/multitaper documentation built on July 29, 2023, 12:09 p.m.