Skip navigation

Community

1 2 Previous Next 4344 Views 25 Replies Latest reply: Jan 23, 2012 8:42 AM by Exovede RSS
Ramon_Campos Calculating status...
Currently Being Moderated

Oct 21, 2011 4:01 PM

EMG Signal Linear Regression implementation

Hello,

 

i'm trying to implement a linear regression of emg signal....

 

i'm reading a file that has the emg signal, and I need to implement linear regression on RMS and FFT signal.

I've read some posts, and was suggested to use the Curve Fitting VI....

 

I'm using lv2010.

 

As in the literature, by the slope of linear regression could detect fatigue of muscle.....

 

Could someone help me to get it works?!

 

Attached the VI and the signal.

Attachments:
  • Currently Being Moderated
    1. Oct 23, 2011 10:02 PM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi Ramon,

     

    I didn't see you VI, but I guess you need to do linear fitting for each muscle contraction instead of fitting for the whole signal which may includes several contractions.

     

    Thanks!

     

    ZJ Gu

  • Currently Being Moderated
    3. Oct 26, 2011 12:41 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hey,

     

    I think this is linear fitting for MPF not for EMG itsself. The time axis is duration for contraction?

     

    Thanks!

     

    ZJ Gu

  • Exovede Calculating status...
    Currently Being Moderated
    5. Oct 26, 2011 8:00 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi,

     

        Usually, you calculate the MDF or MPF by using small moving windows of your signal (like 250 msec) with or without interleave.  So with a 30 seconds signal and taking 250 msec windows of it without interleaving you would get 120 values (30000 msec / 250 msec) of MDF or MPF that you could plot on a graph.

     

    HTH,

     

    Michel

  • Exovede Calculating status...
    Currently Being Moderated
    7. Oct 26, 2011 9:49 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi Ramon,

     

        Yes, you could do it that way.  For each 1000 points, pass a Hanning window on this 1000-points signal then compute the MDF (and/or MPF) then you would have 60 values to plot vs time (each value would correspond to a 0,5 second increment).

     

    Salutations,

     

    Michel

  • Exovede Calculating status...
    Currently Being Moderated
    9. Oct 26, 2011 11:29 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi Ramon,

     

        No, I haven't look your VI...we're still at LV2009.

     

        The fitting for the MDF/MPF vs Time is, usually, a linear fitting and the result is a slope in Hertz/second unit.

     

    Salutations,

     

    Michel

  • Exovede Calculating status...
    Currently Being Moderated
    11. Oct 27, 2011 7:59 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi Ramon,

     

        I can't open the vi's you sent...they seem to still be in LV2010 version.

     

        However, before doing the spectral computing (MDF and/or MPF), I guess you removed the baseline (removing the mean of the 1000-points signal) because if you don't and you have an offset in your signal, the values of MDF/MPF won't be the "real" ones.

     

    Salutations,

     

    Michel

  • Exovede Calculating status...
    Currently Being Moderated
    12. Oct 27, 2011 9:04 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi again Ramon,

     

        I've taken a look at your signal.  There seems to be multiple "bursts" but when you check for fatigue, the level of force ask should be the same then you see a small decline in the amplitude of the raw emg over time and if fatigue happens a decline in the MDF/MPF also in time (shifting toward lower frequencies).

     

    Salutations,

     

    Michel

  • Exovede Calculating status...
    Currently Being Moderated
    14. Nov 1, 2011 9:20 AM (in response to Ramon_Campos)
    Re: EMG Signal Linear Regression implementation

    Hi Ramon,

     

    I've taken a look at your vi. You need to get the correct algorithms for computing the median and/or the mean frequencies.  You can't just do the mean of your power spectrum like that and get something "interesting".

     

    For the median frequency:

     

    1.Add all the values of your power spectrum (PSUM)

    2.Now, do a cumulative sum of your spectrum until the sum reaches half of (PSUM)...the index, multiplied by your frequency step, will be the median frequency.

     

    For the mean frequency:

     

    1. Take your power spectrum and multiply it by a vector representing the frequencies associated with each value of the power

    2. Add all the values of the preceding step (PFSUM)

    3. Divide PFSUM by PSUM to get the mean frequency.

     

    Here are the steps:

     

    [Loop]

    1. Read a 1000 points (corresponding to 0,5 second)

    2. Remove the mean of this 1000-points signal

    3. Pass it through a Hanning window

    4.Do your spectral analysis (medium or mean frequency) -> you'll get one point representing the desired frequency.

    5. Loop for all the 1000-points blocks

    [End of loop]

     

    Now, you have 60 "frequency" points.  Those will be on the Y axis

    The X axis will be the time...each of your "frequency" points is on a 0,5 second increment.

    So, you'll have a vector of 60 points for your Y axis (frequencies) and a vector of 60 points [0.5,1.0,1.5,2.0,...,30.0] representing your time in seconds (you need to build that one).  Just feed those two vectors in the linear fitting vi and you'll get the best "curve" and the slope.

     

    Salutations,

     

    Michel

1 2 Previous Next

More Like This

  • Retrieving data ...

Bookmarked By (0)