LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Threshold Values

Solved!
Go to solution

Hi all

 

If I have a sin-wave captured from an oscilloscope that is passed into labview from zero to 10 seconds, how do I make it so that labview will tell me all the times when the Y values is exactly 0? 

 

 

I've explored the waveform peak detection.vi but am not getting useful back. Is this the correct vi? If so, how do I make it return useful data? 

 

If not, can someone point me to the correct vi?

 

 

Thanks

0 Kudos
Message 1 of 8
(2,881 Views)
Solution
Accepted by topic author Chron0

Extract the Y array from the waveform. Run it through a for loop containing an =0? comparison.  The True outputs mark the presence of zeros.

 

However, comparing floating point numbers to zero (or any other exact value) is not a good idea because of the finite resolution in the binary representation of numbers in the computer.  It is better to compare them to a small range around the desired value (such as zero).  You can use the In Range and Coerce fucntion to do this.  A predifined constant called "Machine Epsilon" represents the smallest value between adjacent numbers on your computer.  It might be appropriate to use a value about the size of one least significant bit on your oscilloscope since that represets the quantization error in your digitzing process.

 

Another way to find zero crossings is to locate points in the waveform where adjacent elements of the array have opposite signs (if no element near the zero corssing is exactly zero).

 

Lynn

Message 2 of 8
(2,879 Views)

Thank you for your response. But will this method tell me all the times, meaning all corresponding values of x, when y is equal to 0? 

 

I'm testing an egine motor and the project requires that we compare the x values to a standard list of acceptable time values (x) for when Y is equal to the thresohld value. 

0 Kudos
Message 3 of 8
(2,859 Views)

If you have a waveform data type then the time (x) of the element Y[i] is t0 + i*dt.   So for any element where the boolean is True, calculate the time.

 

Lynn

Message 4 of 8
(2,855 Views)

Hey Lynn

 

Thanks for your response. I made a case structure to do what you said with the output leading to an indicator but I'm having a hard time figuring out what to do when the case is false. 

 

 

LabView won't let me leave the case structure false empty and displays this error 

 

"Tunnel: Missing Assignment to tunnel"

 

How can I fix this? 

 

 

Thanks

0 Kudos
Message 5 of 8
(2,842 Views)

Meaning I only want to edit the output array when Y=0 and when it doesn't I don't want to add anything onto it. Is there a way to do that?

0 Kudos
Message 6 of 8
(2,839 Views)

It is a bit difficult to tell exactly what you are doing with your case structure.  As you have noticed a case structure must have an output from every case.  Your choices are to move the indicator inside the True case or to pass some value in the False case which cannot occur in the real data.  NaN (Not a Number) may be one possibility, depending on what you do with the data later.

 

Please post your VI or an image (in .png or .jpg format) so we can see what you have tried.

 

Lynn

0 Kudos
Message 7 of 8
(2,836 Views)

Actually I got it to work out. Thanks a bunch for your help

0 Kudos
Message 8 of 8
(2,821 Views)