SignalExpress

cancel
Showing results for 
Search instead for 
Did you mean: 

EMG analysis, median frequency, FFT

Good morning, We're trying to analyze EMG signal with LabVIEW. To get the median frequency of the signal, I generally do a FFT of it to get the spectral distribution and then simply look at the median frequency. However, I can not find the tool or the sub-Vi allowing to enter the signal + the acquisition frequency and giving the FFT graph as an output. Does anybody having already face this problem?

 

Thanks,

 

Sebiv

0 Kudos
Message 1 of 27
(15,941 Views)

Hi Sebiv,

 

Sorry if I am misunderstanding you, but why do the FFT or Power Spectrum functions suit your needs for this?

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 2 of 27
(15,927 Views)

Dear Will,

 

The only output that i really need is the median frequency of the EMG signal. To get this value, we generally apply a FFT on the raw signal and after look for the median frequency. We got a FFT transformation (see below) but we're not able to get a median frequency of it.

 

 

 1.PNG

Here is an example of the procedure applied by a specialised software (i.e. Biometrics) to calculate the median frequency. We can mimic this procedure or use any other one, doesn't matter.

From Biometrics: The median frequency is calculated for a block of samples whose length is defined by the filter constant. This calculation is repeated as necessary across the trace and the resulting frequencies plotted as a series of lines connecting the calculated median frequencies. The following steps are performed: - A block of samples defined by the filter constant is taken and zero padded to the nearest power of 2. - A Windowing function applied to the data as specified by the selection at the bottom left of the Settings Window. See Using FFT Windowing Functions for more information.- An FFT is performed and, if selected, FFT High Pass Filters are used to Remove DC and to Remove Very Low Frequencies from the calculations. Note that a large DC component can seriously degrade the accuracy of the median frequency calculation.- The amplitude magnitude of each FFT output frequency is squared.- The median frequency is determined such that the area of the amplitude-squared frequency graph below the median frequency is the same as above the median frequency i.e. there is equal power either side of the median frequency.- The process is repeated for the next block of samples.
0 Kudos
Message 3 of 27
(15,921 Views)
Here is our VI so far...
0 Kudos
Message 4 of 27
(15,920 Views)
And here is the data
0 Kudos
Message 5 of 27
(15,919 Views)
Perhaps you could try another route. You could use the Peak Detector VI in order to identify the number of peaks and their locations in your FFT. Then you can do some quick math to find the middle/median peak.
Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 6 of 27
(15,896 Views)

The analysis recipe you quote is relatively easy in LabVIEW.  Use Mean.vi to compute the mean of your original signal, then subtract this from your original signal to remove any DC offset.  Use any of the *Window.vi to perform a window on this data.  Now use FFT.vi to compute the FFT.  Convert the output to magnitude/phase using the  Complex to Polar primitive.  Square the magnitude (use the Multiply primitive with both inputs wired to the magnitude output).  Integrate the result using Integral x(t).vi.  The last element of the output is the integral of the entire spectrum.  Halve this value to find the value at the median point.  Search the integral output for this halved value, using interpolation if you wish.

 

Let us know if you run into issues.  Please post the version of LabVIEW you are using.  The above instructions where generated using LabVIEW 7.1.  Newer versions have functions which combine some of these steps.

 

P.S. You have posted this in the SignalExpress section of the discussion forums.  You will get better response by posting LabVIEW questions in the LabVIEW section.

0 Kudos
Message 7 of 27
(15,838 Views)

Dear Gray,

 

Thank you for the reply. We are using LabView 8.5. Would it be the same solution or there is another way to do it?

 

Thanks alot for the help!

 

Best Regards,

 

Sebiv

0 Kudos
Message 8 of 27
(15,833 Views)
The analysis can be done the same way in both versions.  LabVIEW 8.5 has a richer set of analysis functions which can simplify your calculations.  For example, instead of explicitly windowing your data, doing an FFT, and converting to magnitude/phase with three VIs, this can be done with one VI (FFT Spectrum (Mag-Phase).vi) in 8.5.
0 Kudos
Message 9 of 27
(15,829 Views)

Hi,

 

we have tried to follow the steps you suggested but we are facing some difficulties. Please take a look what we did so far and let us know where did we go wrong...

 

Thank you for your help and patience!

 

Best Regards,

 

Sebiv

0 Kudos
Message 10 of 27
(15,755 Views)