LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I detect number of transitions in my acquired data?

I am trying to detect the number of transitions that occur in my data set. I am expecting two transitions in my data set, when a channel is turned on to 10v and then back to 0v. I have not found any vi to help me. Using peak detections seems like a viable option, however, you have to specify the width of a threshold crossing and when it finds the positive 10 volts it returns over 3000 "peaks" even though it is not finding multiple transitions but, the same 0-10V transition I am already expecting.
0 Kudos
Message 1 of 6
(3,572 Views)
The threshold.vi in the array pallette will give you the interpolated x-value of when your data set increases above the threshold value. It should be possible to use this vi to find all of the transitions in your data.
0 Kudos
Message 2 of 6
(3,572 Views)
I tried using the threshold array vi. However, I am expecting the signal to go high at some point. When I put the threshold vi in a while loop it returns every index at which the signal is high and the array that is extremely large. I am wanting to check before and after the signal goes high for other transitions (with the expectation that I will definitely have 2 transitions at some point). Maybe there is not a simple solution to this problem.
0 Kudos
Message 3 of 6
(3,572 Views)
Are you trying to detect the transitions as you collect your data or with the completed data set? If you are testing while collecting, a fast transition will give a large derivative. By subtracting the last 2 values, you should get a large difference when you have reach a transition, with the sign proportional to the direction of the transition. This could also be done on a completed data set by shifting the entire array by one position before subtracting, but you would be dealing with 2 copies of your data set.

On the other hand, if you used threshold array.vi, after detecing the first transition from 0 - 10V, then invert your data by subtracting the it from 10V and start checking for the threshold at the next point. By inverting your data after
each identified transition, you keep the values you are searching below the threshold value until the next transition.
0 Kudos
Message 4 of 6
(3,572 Views)
Hi,
you can also use the Transition Measurements.vi you find in the waveform measurements palette.It allows you to set many transition conditions; the measurement info cluster returns the timing of the detected transition.
Good luck,
Alberto
0 Kudos
Message 5 of 6
(3,572 Views)
I tried your second suggestion, with setting threshold and then inverting the array. It worked great, thanks for the help!
0 Kudos
Message 6 of 6
(3,572 Views)