SignalExpress

cancel
Showing results for 
Search instead for 
Did you mean: 

EMG analysis, median frequency, FFT

You did not include all your subVIs, so I cannot really determine what the problem is.  However, I do have some comments:

  1. The very complex FOR loop at the start of the VI could probably be replaced by judicious use of the Array Max & Min function (found in the array palette).
  2. You read data from a spreadsheet file and immediately convert to Dynamic Data Type.  This conversion does not include any timing information, which may be why your functions are failing.  Convert to waveform data types, then add the timing information, or use the 2D array and get pieces using Array Subset.  I do not use the Dynamic Data Type, since it hides the underlying data structure, leading to problems like the one you are facing.
Please put your main VI, all subVIs, and a sample data file into a ZIP file and post it so we can look at it.  You can get the main VI and all subVIs by choosing File»Save As... from the main VI, then choosing Duplicate hierarchy to a new location.  ZIP it from the new location.
0 Kudos
Message 11 of 27
(6,453 Views)

Hi Gray,

 

Thanks for the reply. Here is the zipped file with subVIs and sample data file.

 

We appreciate your help!!

 

Best Regards,

 

Sebiv

Download All
0 Kudos
Message 12 of 27
(6,446 Views)
You are working far too hard at this.  LabVIEW has a lot of high-level VIs which can help you out.  I believe that attached VI does what you want to do.  Let me know if you need further help.
0 Kudos
Message 13 of 27
(6,439 Views)

Hey there - we have created a LabVIEW Biomedical User Group on ni.com here:  http://decibel.ni.com/content/groups/biomedical-user-group

 

We would like to collect examples of LabVIEW code that is useful for biomedical signal processing (and image processing, and any other interesting or potentially useful applications in the life sciences) and pull it together in a forum that is easier to manage, share, contribute, etc.

 

DFGray - would you mind posting this EMG analysis VI in our Wiki (or "Documents") area or allowing me to do so?

 

Thanks,

Steve (moderator)

0 Kudos
Message 14 of 27
(6,435 Views)

Hi Gray,

 

Thank you for the attached VI. Can you just please clarify where we can get the Median Frequency- where should we place the indicator to get the correct value?

 

Thank you in advance!!

 

Best Regards,

 

Sebiv

0 Kudos
Message 15 of 27
(6,427 Views)

The median frequency is the output of the large loop, plotted with the raw data trace.  I reopened the VI and noticed it had lost my nice formatting due to not saving the data in the graph.  I have reversed the order of the plots so the median frequency will now show up on top and redone the formatting so you should be good.  Note that this VI is quite a bit larger due to the data in the graph.

 

I posted the VI and sample data to the biomedical user group.  You can get it here.

 

P.S.  My first job out of graduate school was designing medical instrumentation for Hewlett-Packard and I maintain an interest in the field.

Message Edited by DFGray on 07-08-2009 07:47 AM
Message 16 of 27
(6,423 Views)

Thank you for your help with this - I am trying to do a similar thing in lab view with Centre of Pressure Data. 

 

In attempting to use your code, I am confused with what "Filter Width" should be set to. Is it relative the the sampling frequency and length of collection? In addition, does this code give mean power frequency or only median power frequency?

 

Thank you very much for your help.

 

 

0 Kudos
Message 17 of 27
(5,306 Views)

Filter width should be set to whatever length of data you would like to analyze at each run.

 

This calculation is a median.  You can get the mean by dividing the area under the curve by the curve interval (filter width).  All the information is already there.

0 Kudos
Message 18 of 27
(5,297 Views)

Thank you for your quick reply. Sorry to continue with this, but in your demo, your filter width was set at 1000 for a dataset with 150000 data points (sampled at 2500Hz). How did you decide on a filter width of 1000 given those parameters.

 

The length of my data file is 7680 points sampled at 256Hz (30 seconds). I still can't decide what filter width would be appropriate given those parameters. Do you have any insight on this?

 

Thank you very much

0 Kudos
Message 19 of 27
(5,295 Views)

The default filter width was set by the original author, so I had no input.  However, to pick this filter, you need to trade off frequency resolution with how responsive you want the calculation to be.  For example, if you set the filter width to 100, you will get updates every 0.39s (100/256) and your frequency resolution will be about 2.5Hz (256/100).  You can sort of get around both of these issues by changing how you calculate things.  For example:

 

  1. Instead of picking successive sections to run the calculation on, use a sliding window that increments by a fraction of the actual filter width.  For example, move forward by ten points, but take 100 for the calculation.
  2. Use linear interpolation between data points to find the median.  I believe the above calculation takes the nearest point (it has been awhile since I wrote it).
Good luck!

 

0 Kudos
Message 20 of 27
(5,268 Views)