Moving Root Mean Square
Compute the moving root mean square (RMS) of the input signal.
movingrms(x, width = 0.1, rc = 0.001, fs = 1)
x |
Input signal, specified as a numeric vector or matrix. In case of a matrix, the function operates along the columns |
width |
width of the sigmoid window, in units relative to |
rc |
Rise time (time constant) of the sigmoid window, in units relative
to |
fs |
Sampling frequency. Default: 1 |
The signal is convoluted against a sigmoid window of width w
and
risetime rc
. The units of these parameters are relative to the value
of the sampling frequency given in fs
.
A list
containing 2 variables:
Output signal with the same dimensions as x
Window, returned as a vector
Juan Pablo Carbajal, carbajal@ifi.uzh.ch.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
N <- 128 t <- seq(0, 1, length.out = N) x <- sigmoid_train(t, c(0.4, Inf), 1e-2)$y * (2 * runif(length(t)) - 1) fs <- 1 / diff(t[1:2]) width <- 0.05 rc <- 5e-3 ret <- movingrms(as.numeric(scale(x)), width, rc, fs) plot(t, x, type = "l", col = "red", xlab = "", ylab = "") lines(t, ret$rmsx, lwd = 4, col = "black") polygon(c(0, t, length(t)), c(0, ret$rmsx, 0), col = "blue") lines (t, ret$w, lwd = 2, col = "green") legend("topleft", c("data", "window", "movingrms"), lty = 1, col = c("red", "green", "blue"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.