RFIF provides an R interface to a C implementation of Fast Iterative Filtering (FIF) for decomposing a univariate signal into intrinsic mode functions (IMFs) plus a residual.
Install from a source tarball:
install.packages("RFIF_1.0.tar.gz", repos = NULL, type = "source")
RFIF performs many FFTs during decomposition. To guarantee portability, the package ships with a self-contained fallback FFT that works everywhere, but it can be much slower.
For best performance, RFIF can use FFTW3 when available.
During installation:
pkg-config → RFIF enables the fast FFTW backendWhen FFTW3 is found, installation prints:
Found fftw3 via pkg-config (enabling fast FFT).
sudo port install pkgconfig
sudo port install fftw-3
Verify:
pkg-config --modversion fftw3
brew install pkg-config fftw
sudo apt-get install libfftw3-dev pkg-config
Install Rtools: https://cran.r-project.org/bin/windows/Rtools/
Open the Rtools MSYS2 shell, then install FFTW and pkg-config:
pacman -S mingw-w64-x86_64-fftw
pacman -S mingw-w64-x86_64-pkg-config
Verify:
pkg-config --modversion fftw3
Then install RFIF from source in R as usual.
library(RFIF)
t <- seq(0, 1, length.out = 1000)
x <- sin(2*pi*5*t) + 0.5*sin(2*pi*20*t)
res <- rfif(x)
str(res)
Returned object:
imfs: numeric matrix (rows = IMFs, columns = time)residual: numeric vector (same length as input)nimf: integer number of IMFsrecon <- if (res$nimf > 0) colSums(res$imfs) + res$residual else res$residual
max(abs(x - recon))
browseVignettes("RFIF")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.