LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a function to output the crossing point of two plotted lines

 
I got some data plotted on a graph, I need to find the crossing point  of the plotted lines on the graph (The plotted data curves are not linear lines) and detect it by an indicator. I could compare the to data arrays plotted and output the two closest data numbers, but the really crossing pionts is sertainly an intercept of two Interpolated values made by the graph, wich are not in my data buffers. any suggestions will be full Stared   
 
 
Zamzam
HFZ
0 Kudos
Message 1 of 4
(3,908 Views)
I only did a cursory look and didn't find any built-in function that jumped up screaming "I'm it! I'm it!", but that doesn't mean something doesn't exist given the large number of functions available with LabVIEW. An alternate solution is to use linear interpolation between successive points. If the points are close together then you can assume a straight line between the points and break this down to the simple case of finding the intersection of two lines, which is trivial. Not sure how computationally intensive of an algorithm this would be, and there would clearly be some error involved, and you will need to determine if the error is tolerable for you.
Message 2 of 4
(3,898 Views)

I just ran across the same problem.  I have 2 curves and I need to find the intersection.  Here's the solution:

1.) Get a fit of the two curves.  In my case, a second order polynomial.

2.) Subtract the two sets of coefficients.

3.) Use the resulting coefficients to create a third curve.  Anyplace where it crosses 0 is where the two original curves are equal.  I think LV has a vi to find he zeros of a curve.

 

Good luck.

0 Kudos
Message 3 of 4
(3,800 Views)
Doug,

If your curves are always second order polynomials, just use the analytic solution to calculate the location directly rather than using a zero finder.

y1 = a2*x^2 + a1*x + a0
y2 = b2*x^2 + b1*x + b0

then the intersection of the curves is at

x = [-(a1-b1) +/- sqrt((a1-b1)^2 - 4*(a2-b2)*(a0-b0))]/[2*(a2-b2)]

Lynn
0 Kudos
Message 4 of 4
(3,787 Views)