
onoff_bonato(data, channel, sigma_n, Pfa = 0.05, m = 5, r0 = 1, minL = 15, data.name)
channel
is the specific channel to be considered by the procedure. Possible values: a character vector specifying the name of the channel to be considered (case sensitive) or a numeric value specifying the channel to be considered (number of column in data
).
m
which must be over the threshold (see Details) to detect the signal.
data
.
Pfa
) and then observing m
successive samples: if
at least r0
out of the m
successive samples are above the threshold the presence of the signal is acknowledged.
onoff_singlethres
# Load a data.frame with EMG data
data(emg95306000)
# Coerce a data.frame into an 'emg' object
x <- as.emg(emg95306000, samplingrate = 1000, units = "mV")
# change graphical parameters to show multiple plots
op <- par(mfrow = c(2, 1))
# Estimate 'sigma_n' from the last 200 samples (only baseline noise)
sigma_n <- sd(tail(x$values, 200))
# Detect the phases of activation in x
b <- onoff_bonato(x, sigma_n = sigma_n, m = 10, minL = 30)
# Plot 'x' and the detected phases
plot(x, main = "Sample EMG")
plot(b, type = "l", main = "Detected phases (Bonato's method)")
# reset graphical parameters
par(op)
Run the code above in your browser using DataLab