R/transformReflection.R

Defines functions .transformReflection

# Spectral grid of the VMD family. The record of N samples is extended to
# T = 2N samples by reflecting ceiling(N / 2) samples at the start and the
# remaining ones at the end (vmd.model.es.qmd:269), and every column is
# transformed with the unnormalized DFT (eq-marco-dft). The angular grid is
# |omega| in rad/s, 2 pi min(j, T - j) / (T dt) for j = 0, ..., T - 1 in the
# order of stats::fft (descomposicion.model.es.qmd:63, 135). observed holds
# the positions of the record inside the extension.
.transformReflection <- function(signal, samplingInterval) {
    signal <- matrix(signal, nrow = NROW(signal))
    n <- nrow(signal)
    Left <- ceiling(n / 2)
    Positions <- c(Left + 1 - seq_len(Left), seq_len(n),
                   n + 1 - seq_len(n - Left))
    j <- seq_len(2L * n) - 1L
    list(spectrum = stats::mvfft(signal[Positions, , drop = FALSE]),
         angularFrequency = 2 * pi * pmin(j, 2L * n - j) /
             (2 * n * samplingInterval),
         observed = Left + seq_len(n))
}

Try the xemd package in your browser

Any scripts or data that you put into this service are public.

xemd documentation built on Nov. 9, 2026, 1:09 a.m.