Computes the RMS-envelope or the MA-envelope of an EMG signal.

1 |

`data` |
an ‘emg’ object. |

`channel` |
in case of multi-channel data, |

`method` |
a string, "MA" (default) for MA-envelope or "RMS" for the RMS-envelope. |

`wsize` |
determines the length of the moving window that is used to calculate the local averages of the data. |

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

`...` |
Optional parameters for a MA-envelope: |

The MA-envelope corresponds to the moving average of the rectified EMG.

The RMS-envelope corresponds to the moving average of

*y_i=(x_i-mu)^2*

where *x_i* is each value of the EMG signal and *mu* is the overall mean of the EMG signal.

An ‘emg’ object containing the envelope of the EMG.

A direct option to compute the linear envelope (LE-envelope) is not provided, but it can be indirectly computed as shown in the examples.

J.A. Guerrero jaguerrero@correo.uaa.mx

Konrad P. (2005) The ABC of EMG: A Practical Introduction to Kinesiological Electromyography. Version 1.0, Noraxon INC. USA.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
# Simulate 5 seconds of an EMG
emgx <- syntheticemg(n.length.out = 5000, on.sd = 1, on.duration.mean = 350,
on.duration.sd = 10, off.sd = 0.05, off.duration.mean = 300, off.duration.sd = 20,
on.mode.pos = 0.75, shape.factor = 0.5, samplingrate = 1000, units = "mV",
data.name = "Synthetic EMG")
# MA-envelope
emgma <- envelope(emgx, method = "MA", wsize = 60)
# Superimpose the envelope on the EMG
plot(emgx, main = "MA-envelope")
plot(emgma, add = TRUE, lwd = 4, col = "red")
# RMS-envelope
emgrms <- envelope(emgx, method = "RMS", wsize = 60)
# Superimpose the envelope on the EMG
plot(emgx, main = "RMS-envelope")
plot(emgrms, add = TRUE, lwd = 4, col = "red")
## Not run:
# Computation of the LE-envelope
library(signal)
bf <- butter(2, 1/50, type = "low")
b <- filter(bf, emgr$values)
plot(emgx, main = "LE-envelope", timeunits = "samples")
lines(b, lwd = 2, col = "red")
# Note that there is a visible lag time on the envelope
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.