Biomedical User Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract any segment from continuously acquiring biosignal for Calibration purpose

Hi everybody,

I am doing a program controlling a simple robotic hand, which made from one servo, using sEMG. The hand is expected to open and close when the sEMG's RMS goes up and down the threshold. To determine this threshold, I do a separated tab called Calibration. It asks the user to open the hand for 3s, then close it for another 3s. The threshold is automatically calculated by averaging the maximum and minumum value in this 6s signal segment.

Still, I dont know how to extract any segment of a continuously acquiring signal.

0 Kudos
Message 1 of 2
(3,144 Views)

How you extract your data from a continuously acquired signal depends upon what you want from the data and how you are taking it.  If all you want is a max/min over a time period, do the following:

  1. In your acquisition loop, set up two shift registers - one for max and one for min (can also use a single shift register with a cluster containing the max and min)
  2. Initialize the max to -Infinity and the min to +Infinity (wire the shift registers from outside the loop with the appropriate constants).  Note that if you are using integers, use the appropriate max and min for the integer type.
  3. At each iteration of the loop, while taking data, take an array max/min of the data you just collected.
  4. Replace the shift register max with the maximum of the array max and the previous shift register max.
  5. Replace the shift register min with the minimum of the array min and the previous shift register min.

Let us know if you need more information.  Please post your current code for future questions.

0 Kudos
Message 2 of 2
(2,790 Views)