12-07-2012 02:10 PM
Have a zero crossover vi and can't seem to capture the actual zero crossover when positive going negative. It doesn't capture the zero value it captures the next value. I just can't seem to find out why. Please find the attached vi along with a small text file for use with the vi.
Thanks for any help you can provide......
Have a good weekend.
DG
12-07-2012 03:38 PM
Way too much code!
12-07-2012 04:15 PM
First of all, you seem to have duplicate X values, so that will complicate things. Can you save the file with higher resolution?
All you need to do is a linear interpolation to get the zero crossing.
12-07-2012 05:22 PM
It may not be exactly what you want but Threshold 1D Array seems to be close. Because it only looks for crossings of the threshold in the positive direction, you need to negate the array after each crossing is found if you want to find crossings in both directions. It also tends to define the last element as a crossing, so I deleted that. Read the detailed help file for more information about how the function works.
This will not be memory efficient for large arrays because it makes a copy for the negated array. If the threshold is ever made something other than zero, the negation needs to be changed to a reflection around the threshold.
Lynn