Iterative Filtering
decomposeIF.RdDecomposes a signal by successive extraction of components, each obtained by iterating the subtraction of a moving average whose filter is a supplied prototype resampled to a support set by the extrema of the residue.
Arguments
- signal
Numeric vector of finite values without
dim, in the units of the quantity. Positions are sample indices.- filter
Prototype filter, a numeric vector of finite weights of odd length, at least 3. No default. The package tests use the 13 weights that fifpy obtains from its prototype for a half width of 6.
- boundary
"zero"extends the record with zeros;"periodic"extends it periodically and evaluates the iteration spectrally (fast iterative filtering). No default.- tolerance
Bound of the relative change between consecutive iterates, greater than zero and less than one. No default; the package tests use \(\sqrt{0.001}\).
- maxIterations
Whole number \(\ge 1\) of iterations of one extraction. No default; the package tests use 200.
- stretch
Number greater than zero that scales the support of the filter. No default; the package tests use 1.6.
- maxModes
Whole number \(\ge 1\) or
Inf, the limit of extractions; defaultInf.
Details
Before extraction \(k\) the decomposition ends with
"terminalResidue" when \(r_{k-1}\) has at most one extremum and
with "modeLimit" when \(k - 1\) equals maxModes. Otherwise
the half width is \(l_k = 2\,\mathrm{round}(\mathrm{stretch}\, N / E)\)
for the \(E\) extrema of \(r_{k-1}\); from the second extraction a value
that does not exceed the previous half width becomes
\(\lceil 1.1\, l_{k-1} \rceil\). The prototype is resampled to
\(2 l_k + 1\) weights and the iteration
$$f^{(q)} = f^{(q-1)} - \mathcal{L}_w f^{(q-1)}, \qquad f^{(0)} = r_{k-1},$$
with \(\mathcal{L}_w\) the moving average under boundary, stops at
the first \(q\) with
\(\|f^{(q)} - f^{(q-1)}\|_2 / \|f^{(q-1)}\|_2 \le\) tolerance
(converged TRUE) or after maxIterations
(converged FALSE). Then \(c_k = f^{(Q)}\) and
\(r_k = r_{k-1} - c_k\). A shrinking prototype is integrated over
rescaled bins; an enlarged one is interpolated linearly and normalized to a
unit absolute sum. The components are not shown to satisfy the counting
conditions of intrinsic mode functions.
Value
A list with
- modes
Double matrix, samples by components.
- residue
Numeric vector, the final residue.
- iterations
Integer vector, the iterations \(Q\) of each component.
- converged
Logical vector by component.
- stopReason
"terminalResidue"or"modeLimit".
References
Cicone, A. and Zhou, H. (2018). Numerical Analysis for Iterative Filtering with New Efficient Implementations Based on FFT. arXiv:1802.01359.
The support rule, the resampling of the prototype and both iterations are adapted from fifpy, revision 26e51e7d45e551950dea8be37ece447fc4340296, copyright (c) 2022 Emanuele Papini, MIT License; see the NOTICE file of the installed package.
Examples
Time <- seq_len(1000) / 1000
Signal <- cos(2 * pi * 2 * Time) + 0.25 * cos(2 * pi * 24 * Time) +
0.0625 * cos(2 * pi * 288 * Time)
Filter <- c(6.6306270449357867e-06, 0.00053827687799438354,
0.0082858777882808092, 0.044245208647455882, 0.11927281750086954,
0.20513332487239222, 0.24503568511284984, 0.20513332487239222,
0.11927281750086952, 0.044245208647455903, 0.0082858777882808109,
0.00053827687799438213, 6.6306270449358087e-06)
OUT <- decomposeIF(Signal, filter = Filter, boundary = "periodic",
tolerance = sqrt(0.001), maxIterations = 200,
stretch = 1.6, maxModes = 3)
OUT$iterations
#> [1] 3 3 1
OUT$stopReason
#> [1] "modeLimit"
Zero <- decomposeIF(Signal, filter = Filter, boundary = "zero",
tolerance = sqrt(0.001), maxIterations = 200,
stretch = 1.6, maxModes = 3)
Zero$iterations
#> [1] 6 5 22