biosignalEMG (version 2.0.0)

onoff_bonato: Automatic on/off detection algorithm based on a double threshold scheme

Description

Automatic detection algorithm to determine the times at which muscles “turn on” (activity periods) and “turn off” (silence periods) in an EMG signal.

Usage

onoff_bonato(data, channel, sigma_n, Pfa = 0.05, m = 5, r0 = 1, minL = 15, data.name)

Arguments

data
an ‘emg’ object.
channel
in case of multi-channel data, 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).
sigma_n
standard deviation of the baseline noise (need to be estimated).
Pfa
false-alarm probability (see ‘Details’).
m
number of samples observed to perform the detection.
r0
minimum number of samples out of m which must be over the threshold (see Details) to detect the signal.
minL
minimum length allowed of the detected phases.
data.name
a string specifying the name of the variable which will appears on the plots. If empty or not provided is taken from the object given as data.

Value

A numeric vector with values 0 (silence) and 1 (activity).

Details

This technique of detection consists of selecting a initial threshold (such that the probability of false alarm is 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.

References

Bonato P., D'Alessio T. and Knaflitz M. (1998) A statistical method for the measurement of muscle activation intervals from surface myoelectric signal during gait. IEEE Transactions on Biomedical Engineering 45 (3), 287--299. ISSN 0018--9294.

See Also

onoff_singlethres

Examples

Run this code
# 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