biosignalEMG (version 2.0.0)

onoff_singlethres: Automatic on/off detection algorithm based on a simple threshold rule

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_singlethres(data, channel, t = 0.05, 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).
t
a threshold value to determine if a datum reresent activity (above the threshold) or silence (below the threshold) in a signal.
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

In this procedure, on and off time estimation is determined by the times at which the envelope of the signal (determined using envelope) exceeds a threshold.

References

Rose W. (2014) Electromyogram Analysis. Mathematics and Signal Processing for Biomechanics. http://www.udel.edu/biology/rosewc/kaap686/

See Also

envelope, onoff_bonato

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))

# Detect the phases of activation in x
b <- onoff_singlethres(x, t = 0.1)

# Plot 'x' and the detected phases
plot(x, main = "Sample EMG")
plot(b, type = "l", main = "Detected phases (single thresholding)")

# reset graphical parameters
par(op)

Run the code above in your browser using DataLab