LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Identify every Peak + Valley = Amplitude that is great than a set Threshold Amplitude in an EMG Signal (Turns-Amplitude Analysis)

Hello,

 

I am currently trying to write a program that will perform Turns-Amplitude Analysis. This requires the identifcation of the amplitude for every turn in an EMG signal thats Peak + Valley = greater than a set threshold. Where I am running into problems is in keeping one peak the same until I identify the next valley (and vis versa) that is greater than the threshold. I have attached a picture that dipcts what I am trying to achieve.

 

Any advice or help would be extremely appreciated.

0 Kudos
Message 1 of 10
(4,270 Views)

Do you have a robust definition of what constitutes a "turn"?  For example why is the first valley immediately after the first turn not another turn? You mention a threshold in your post but no threshold is shown in the image. Is Amplitude the threshold? How is the threshold set?  How long are the sample sets? Do you need to track turns which are partly in one sample set and partly in the next one?

 

Lynn

0 Kudos
Message 2 of 10
(4,261 Views)

Hello Lynn,

 

Thank you for your response.

 

1) A turn is any change in amplitude that is equal to or greater than 100 microvolts.

2) The threshold is 100 microvolts. For instance is a valley is -30 microvolts, then next turn wont occur until a peak is greater or equal to 70 micovolts (totalling 100 micovolt differences between the peak and valley)

3) The sample sets that I am running are 2000 data points. (collected 2000 points a second and want to measure how many turns occur in a one second period.

4) No I do not need to track turns between samples. Each file is its own sample and I will be running each 1 second file through individually.

 

I hope that these answer all the questions. Thank you again for your help and let me know if there is anything else you need,

 

Cory

0 Kudos
Message 3 of 10
(4,255 Views)

Cory,

 

Thank you for the clarifications.  I need to leave in a few minutes so do not have time to put together anything.

 

Consider autoindexing through the data array. Use Min Max function and shift registers to locate peaks and valleys. Each time you find a new peak or valley compare to the threshold. If it quaiifies as a turn, then reset the location register and continue looking for the next turn.

 

Lynn

 

 

0 Kudos
Message 4 of 10
(4,246 Views)

There's some peak detection/analysis already built-in to LabVIEW.

 

Have you looked at:

http://www.ni.com/white-paper/3770/en/ 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvanls/peak_detector/

 

It might save you a lot of work.

0 Kudos
Message 5 of 10
(4,214 Views)

Hi Kyle,

 

Thank you for the suggestions. I am aware of those VI's and can identify peaks and valleys, however, these tools do not allow me only select the peak and valley combinations that total 100 microvolts regardless of the peaks inbetween (i,e. if I have a valley of -30 microvolts then i need to identify the next peak that is 70 or greater microvolts, then I might have the next might be -45, therefore needing a peak of 55 or greater). Therefore, I am running into problems setting a specific threshold with the peak and valley detector.

 

Any suggestions on solving this would be great. I am currently attempting to try the method Lynn described previously. I will see how this works.

0 Kudos
Message 6 of 10
(4,207 Views)

Hi Lynn,

 

I have been playing around with the idea that you presented and am having issues with how to setup the shift registers so that it it switches back and forth between peak and then valleys. That is, Peak 1 to Valley 1, then Valley 1 to Peak 2 (Assuming those data points totals were greater than the 100 threshold). Any examples or advice you could give would be greatly appreciated. Thank you again for all your help.

0 Kudos
Message 7 of 10
(4,184 Views)

Since my dad had a EEG (and knew how to read it ;), he's retired now, but still run a website to help parents of kids with seizure(s)  )  here is my try of a solution:

Used point by point search peak/valley vi and shift register to store value and index of the last peak and valley.

You only can judge for a turnpoint if you have the the next valid turnpoint (or have to update the former in case of a higher/lower value)

Wasn't shure how to handle the first point, so still some homework to do.

turnpoints.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 8 of 10
(4,156 Views)

Hi Henrik,

 

Thank you very much, this definitly very helpful. I was looking through the code and was wondering is this set to take a peak/valley every few data points, or how would I adjust the threshold for the turn points (the distance)?

 

Also, how would I extract the amount of turns that occured in the signal, as well as the total amplitude difference for each turn?

 

Thank you again for sharing this VI and helping, I greatly appreciate it.

0 Kudos
Message 9 of 10
(4,141 Views)

The output of the for loop is an array of index and an array of corresponding values.....

so the number of elements (size) of the array is the number of turnpoints..... ignoring the fact of the not so well defined first and last turnpoint.......

 

Again using that arrray it should be a nice and not so hard homework to extract the differences between two succesice values in an array 😉

 

Did I mention that this is your homework now?

If you run into problems post your code (and actual data) .....

 

What is unclear about the distance control?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 10 of 10
(4,134 Views)