Friday, July 4, 2014

EMG Signal Processing - Smoothing - The Root Mean Square (RMS)


As stated above the interference pattern of EMG is of random nature - due to the fact that the actual set of recruited motor units constantly changes within the diameter of available motor units and the way they motor unit action potentials superpose is arbitrary. This results in the fact that a raw EMG burst cannot be reproduced a second time by its precise shape. To address this problem, the non-reproducible part of the signal is minimized by applying digital smoothing algorithms that outline the mean trend of signal development. The steep amplitude spikes are cut away; the signal receives a “linear envelope”.
Based on the square root calculation, the RMS reflects the mean power of the signal (also called RMS EMG) and is the preferred recommendation for smoothing (Basmajian and DeLuca).
 

    For a set of n numbers or values of a discrete distribution x_i, ..., x_n, the root-mean-square (abbreviated "RMS" and sometimes called the quadratic mean), is the square root of mean of the values x_i^2, namely
x_(RMS)=sqrt((x_1^2+x_2^2+...+x_n^2)/n)
=sqrt((sum_(i=1)^(n)x_i^2)/n)
=sqrt(<x^2>),
where <x^2> denotes the mean of the values x_i^2.
For a variate X from a continuous distribution P(x),
x_(RMS)=sqrt((int[P(x)]^2dx)/(intP(x)dx)),
where the integrals are taken over the domain of the distribution. Similarly, for a function f(t) periodic over the interval [T_1,T_2], the root-mean-square is defined as
f_(RMS)=sqrt(1/(T_2-T_1)int_(T_1)^(T_2)[f(t)]^2dt).
The root-mean-square is the special case M_2 of the power mean.
Hoehn and Niven (1985) show that
R(a_1+c,a_2+c,...,a_n+c)<c+R(a_1,a_2,...,a_n)
for any positive constant c.
Physical scientists often use the term root-mean-square as a synonym for standard deviation when they refer to the square root of the mean squared deviation of a signal from a given baseline or fit.

Here's a link to download Matlab Code with a sub-program implemented in environment Matlab© to get the RMS of EMG signal.
To use the function provided just save the file "rms_gbiomech.m" in the same folder as the data to be analyzed. Then just call in your Matlab routine sub-program as follows in the example below:

your_emg_rms=rms_gbiomech(Signal,Windowing,Overlap,Zeropadding);

where:
your_emg_rms = output variable with RMS of your EMG signal.
Signal = your Raw Signal preferably treated previously with a pass band of 20 to 500 Hz.
Windowing = the analysis window size in number of samples.
Overlap =  overlap size in number of samples.
Zeropadding = fill the difference between the raw signal and the RMS signal with zeros, where value "0" is disabled and value "1" is enabled. The default value is "0".

Note: you can specify the window which will be examined by inserting an index on the input variables.

References:

- Basmajian, J.V., DeLuca, C.J. "Muscles Alive".  Williams & Wilkins, Baltimore, MD, 1985.
- Hoehn, L. and Niven, I. "Averages on the Move." Math. Mag. 58, 151-156, 1985.
- Kenney, J. F. and Keeping, E. S. "Root Mean Square." §4.15 in Mathematics of Statistics, Pt. 1, 3rd ed. Princeton, NJ: Van Nostrand, pp. 59-60, 1962.

Big Hug!

2 comments:

  1. thanks for your information, what input values would you recommend particularly for Overlap and Zeropadding ?

    ReplyDelete
    Replies
    1. The input of the overlap may vary according to the windowing to be set. If windowing having N samples, the overlap may be from 1 to N-1.
      According to the characteristics of your signal, especially the frequency of acquisition and details of the variables of interest, you can choose to major or minor overlaps.
      Regarding zeropadding, it solves a difference problem of the number of samples between the raw signal and the RMS signal inserting zeros, but creates a time delay on the curve behavior, then it is important to know the magnitude of this delay so that by relating RMSemg with other variables that difference is properly corrected.

      Delete