11-23-2015 08:24 AM - edited 11-23-2015 08:25 AM
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.
11-23-2015 08:34 AM
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
11-23-2015 08:44 AM
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
11-23-2015 08:59 AM
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
11-23-2015 11:51 AM
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.
11-23-2015 12:01 PM
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.
11-23-2015 02:22 PM
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.
11-24-2015 08:58 AM
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.
11-24-2015 01:30 PM
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.
11-24-2015 03:04 PM - edited 11-24-2015 03:12 PM
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?