LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

intersection between curves

Hi

I need to create some function that will be able to find the intersection points of curves and put them into an array.  I am trying to do it on the graph attached in which there are four curves.  In the curves, there are four cursor points which are the ones that I need to obtain their coordinate point in the X axis.  For the first curve, I need the highest point in the curve.  For the rest of the curves, I need the intersection points. 

 

Thank you

 

0 Kudos
Message 1 of 8
(5,717 Views)

This question has come up before many times. Did you try a search? Several examples and techniques have been suggested, based on the data. A simplistic approach would be to subtract the values of one graph from the other. The smallest difference indicates the intersection point.

 

In your graphs you are going to have a problem. Apparently, you seem to be using an XY graph, and are appending 0,0 to the end, causing the graph to jump back to the origin. Either that, or one of your graphs has one more point than the others, and you are trying to make all the arrays the same size. Consequently, a (0,0) is added to the other graphs. You will need to fix this.

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

Presumably these curves are being plotted by an array of some sort and I guess an intersection point of two curves is when the two values are equal. So if you implement sum kind of logic that will compare the values of the arrays that are plotting the curves, you will be able to see when the two values are equal to each other and from this you will be able to find the intersection point.

 

I'm sure someone will answer it more eloquently than this but it should be straight-forward enough.

 

Strokes

0 Kudos
Message 3 of 8
(5,706 Views)

Thanks.  You are right and I got to solve the problem with the curves coming back to the origin.  In your suggestion for subtracting the values of one curve from the other, what function would I have to use? and is there is a way of transferring the set of x and y points to an array that I could see in the front panel? thank you

0 Kudos
Message 4 of 8
(5,663 Views)

If the data is in the form of arrays of numeric values, just use the subtract primitive in the Numeric palette.  It is polymorphic and works for arrays just like it works for scalars.  For data with little noise the intersection is between the points where the difference changes sign.

 

Lynn

0 Kudos
Message 5 of 8
(5,638 Views)

thanks, I tried to put the data from the graph into array but it only shows me the last value of the simulation.  I am not sure what kind of array I have to use to get all the points from two differents array to compare them and get the intersection points.  I have attached a picture of what I have done and the only value that I get in the array.

 

 

Download All
0 Kudos
Message 6 of 8
(5,598 Views)

Could you post your code? Those screenshots are particularly instructive as to what might be going on with this application.

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 7 of 8
(5,542 Views)

I have been away from the Forum for a few days.

 

As John asked, please post your code.  The image only shows a piece of it an omits several important details.

 

Clearly, Array 3 has only one value because you Build an array with only one scalar input.  The integer array constant which feeds Array 2 could have as few as one element or millions.  It is impossible to tell from the image.

 

Converting from scalars or arrays of DBL to Dynamic Data Type and back is silly.  Just do everything with Index Array or Build Array and keep the data types scalar or array of DBL.

 

Lynn

0 Kudos
Message 8 of 8
(5,536 Views)