# Biomedical User Group Discussions

cancel
Showing results for
Did you mean:

## 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.

Message 1 of 26
(7,992 Views)

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

Message 2 of 26
(474 Views)

## Re: EMG Signal Linear Regression implementation

Hi ZJ Gu,

my lvm file is a simple contraction with 30 seconds duration....

how do authors implement something to get this graph below ?

Message 3 of 26
(475 Views)

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

Message 4 of 26
(475 Views)

## Re: EMG Signal Linear Regression implementation

Yeah, ZJ Gu!!

X axis is duration for contraction.... and Y axis is the frequencies values of the contraction....

like in some articles, could Y be mean frequency (MPF), median frequency (MDF), RMS values (in time domain)...

but until now i don't have success....

When I read the EMG file (signal.lvm), how to separate Y and X values?

Should read the whole file, or by small samples?

Thanks!

Message 5 of 26
(475 Views)

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

Message 6 of 26
(475 Views)

## Re: EMG Signal Linear Regression implementation

Hi Exovede,

check if I'm right:

I'm using a sampling rate of 2000 Hz. As whole signal has 30 s of duration, there will be 60.000 points .

So, to apply a window of 0,5 s, can I simply configure the Read Meas File to read 1000 points in a while loop until EOF?

That is what i'm already doing....

Message 7 of 26
(475 Views)

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

Message 8 of 26
(475 Views)

## Re: EMG Signal Linear Regression implementation

Hi Exovede,

I will try to make yours suggestion....

Thanks for the tip.

have you take a look in my VI ?

it's missing only the hanning window?

should i use the "curve fitting VI" to generate the "best fit" or use the "linear fitting vi" ?

See ya!

Message 9 of 26
(475 Views)

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

Message 10 of 26
(475 Views)