gzc {DecomposeR}R Documentation

Calculates instantaneous frequency using the GZC method

Description

Calculates instantaneous frequency using the Generalised Zero-Crossing method from Huang et al., 2009. General wrapper for the gzc.algorithm function that does all the actual work.

Usage

gzc(
  emd = NULL,
  ini = NULL,
  m = NULL,
  dt = NULL,
  repl = 1,
  mode = NULL,
  dtout = NULL,
  output = 1,
  warn = TRUE
)

Arguments

emd

emd-type object

ini

an optional vector of length n of the eventual initial Intrinsic Mode Function xy would be a demodulation of, if it is a demodulation. It will be integrated to the results as mode 1.

m

a matrix of the amplitude values (xy) of the components, each column being a component. Each column should have the same number of non NA values. Vectors, for 1 component, are accepted. Is overridden by emd.

dt

the depth or time value. Is overridden by emd.

repl

the amount of replicates in m. Is overridden by emd.

mode

the mode sequence index to give to each replicated IMFs

dtout

the dt values to sample the frequency and amplitude from if output = 2.

output

the style of the output, whether 0, 1 or 2. 0 provides the raw output of gzc.algorithm, 1 and 2 provides a matrix with $dt (depth/time), $f (frequency) and $a ()amplitude, but with output = 1 the matrix provides the dt only at the extremas and zero-crossings, whereas with output = 2 the dt values are the ones provided with the dtout parameter. 1 is better for plots, 2 allows easier calculations to be performed downstream.

warn

whether to warn if the sampling interval defined by the dtout parameter is to small (redirected from StratigrapheR::tie.lim)

Value

depending on the output parameter:

output = 0 provides the raw output of gzc.algorithm, with $ldt and $rdt (the left and right boundaries of the depth/time intervals), $f (frequency) and $a (amplitude). To that are added $repl (the replicate id) and $mode (the mode id)

output = 1 or 2 provides a matrix with $dt, $f and $a, but with output = 1 the matrix provides the dt only at the extremas and zero-crossings, whereas with output = 2 the dt values are the ones provided with the out parameter. 1 is better for plots, 2 allows easier calculations to be performed downstream.

References

Huang, Norden E., Zhaohua Wu, Steven R. Long, Kenneth C. Arnold, Xianyao Chen, and Karin Blank. 2009. "On Instantaneous Frequency". Advances in Adaptive Data Analysis 01 (02): 177–229. https://doi.org/10.1142/S1793536909000096.

Examples

set.seed(42)

n <- 600
t <- seq_len(n)

p1 <- 30
p2 <- 240

xy <- (1 + 0.6 * sin(t*2*pi/p2)) * sin(t*2*pi/p1)  + 2 * sin(t*2*pi/p2) +
  rnorm(n, sd = 0.5) + t * 0.01

inter_dt <- round(runif(length(xy), min = 0.5, max = 1.5),1)

dt <- cumsum(inter_dt)
dec <- extricate(xy, dt, nimf = 7, repl = 1, comb = 50,
                  factor_noise = 10, sifting = 10, speak = TRUE)

## Not run: 
plot_emd(dec, dir = tempdir())
## End(Not run)

integrity(xy, dec)
parsimony(dec)

res <- gzc(dec)

numb <- 4

opar <- par('mfrow')

par(mfrow = c(1,2))

plot(dec$m[,numb], dec$dt, type = "l",
     main = paste("Mode", numb, " + Amplitude"),
     xlab = "xy", ylab = "dt", ylim = c(0, 600))
lines(res$a[,numb], res$dt[,numb], col = "red", lwd = 2)

plot(1/res$f[,numb], res$dt[,numb], ylim = c(0,600),
     xlab = "Period", ylab = "dt", log = "x",
     type = "l", col = "red", lwd = 2, main = "Period")

par(mfrow = opar)


[Package DecomposeR version 1.0.6 Index]