Variational Mode Decomposition (1- or 2-dimensional)
vmd(data, alpha, tau, K, DC, init, tol, verbose = FALSE)
either a vector or a matrix (of type numeric or integer)
a numeric value specifying the balancing parameter of the data-fidelity constraint
a numeric value specifying the time-step of the dual ascent ( pick 0 for noise-slack )
a numeric value specifying the number of modes to be recovered
a boolean. If true the first mode is put and kept at DC (0-freq)
a numeric value. This parameter differs depending on the input 'data' parameter (1-dimensional and 2-dimensional). See the details section for more information
a numeric value specifying the tolerance of convergence criterion (typically this parameter is around 1e-6 for the 1-dimensional and 1e-7 for the 2-dimensional data)
a boolean. If TRUE then information will be printed in the console
a list object of length three which includes the
'u' (collection of decomposed modes)
'u_hat' (spectra of the modes)
'omega' (estimated mode center-frequencies) objects
The 'init' parameter takes the following values for,
1-dimensional data:
0 = all omegas start at 0
1 = all omegas start uniformly distributed
2 = all omegas initialized randomly
2-dimensional data:
0 = all omegas start at 0
1 = all omegas start initialized randomly
https://math.montana.edu/dzosso/code/
require(VMDecomp)
#..............
# 1-dimensional
#..............
N = 250
set.seed(1)
rand_unif = runif(n = N, min = 0, max = 1.0)
f_sig1 = 6 * rand_unif
f_sig2 = cos(x = 8 * pi * rand_unif)
f_sig3 = 0.5 * cos(x = 40 * pi * rand_unif)
f_sig = f_sig1 + f_sig2 + f_sig3
alpha = 2000
tau = 0
K = 3
DC = FALSE
init = 1
tol = 1e-6
set.seed(2)
res_1d = vmd(data = f_sig,
alpha = alpha,
tau = tau,
K = K,
DC = DC,
init = init,
tol = tol,
verbose = FALSE)
#..............
# 2-dimensional
#..............
rows_cols = 10
set.seed(3)
data = matrix(runif(rows_cols^2), rows_cols, rows_cols)
alpha = 5000
tau = 0.25
K = 2
DC = TRUE
init = 1
tol = 1e-7
set.seed(4)
res_2d = vmd(data = data,
alpha = alpha,
tau = tau,
K = K,
DC = DC,
init = init,
tol = tol,
verbose = FALSE)