Biomedical User Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

EMG Signal Linear Regression implementation

Hello again Exovede,

i try to do what you've suggested.... but no sucess archived.....

I save the vi to lv9.

There are 2 tries i shoot. (regression and regression-02)....

If you could take a look at them, please.

Use the signal example that is already posted (signal-01.lvm).

Thanks a lot!

0 Kudos
Message 11 of 26
(1,402 Views)

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

0 Kudos
Message 12 of 26
(1,402 Views)

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

0 Kudos
Message 13 of 26
(1,402 Views)

Hi Michel,

I did what you suggested, to read 1000 point, filter with hanning windows, then applying FFT transform, and after that, the mean calculation. There are 60 values.

I don't realize how to implement linear fitting now. Should I save the mean values in another file before apply linear fitting? Or how to get those values into a array? In linear fitting, Y and X should have same size... now I have 60 values (for Y) , and 60000 values on time axis....  i'm still confusing....

I attached the VI that implements until the power spectrum transform, for lv 8.5.

Thanks!

Message 14 of 26
(1,402 Views)

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

0 Kudos
Message 15 of 26
(1,402 Views)

Hi Michel,

i'm still "breaking my head" on this problem.....

i've done a MDF calculator..... can you see if its right? (already saved for lv 8.5)

and by the way.... if that's right, how do I "build a array" to save the mdf values?

Thanks,

Ramon Campos

0 Kudos
Message 16 of 26
(1,402 Views)

Hi Ramon,

    I've put my computation of MDF in your code.  However, for the task you wish to do you need to split your data in 1000-points segments and do the calculation on each segment.  You can do an indexed loop with the MDF result connected to it and you'll get your array of MDFs.  Here's your modified vi for the MDF.

Good luck,

Michel

0 Kudos
Message 17 of 26
(1,402 Views)

Hello my friend Michel!!

i did it!!!

a plenty of "POG" helped too!!

heheheh

Take a look if that's on the way.

Thank a lot for your touch on my codes.

0 Kudos
Message 18 of 26
(1,402 Views)

Hi Ramon,

    I'd like to look at it but nothing was attached to the message.  😉

Salutations,

Michel

0 Kudos
Message 19 of 26
(1,402 Views)

> Ops!!

> i'm sorry....

> but it was good, because i've done the mpf too.

> thanks.

--------------

I did as your algorithm before and try to implement the MPF.

I think it's got better!

btw... mpf values are smaller then mdf values?

Thanks again.

Message 20 of 26
(1,402 Views)