From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding every Intersections of 2 channels

Solved!
Go to solution

Hello everyone!

 

I am trying to build a script that finds the intersecting points.

If you look at the "Example.png" image, you can see that I have 2 random curves.

I want to find the intersecting points and plot them.

Thus, in the report I save "automatically", I want to have both my original curves, and markers at the intersections. 

 

I thought this would be easy if I can use something from the "Event Search", but I am stuck with finding the right conditions. 

[I was expecting to get the points where designators A & B were equal to each other(A=B) would give me the x-coordinates of when the intersections occur]

 

I've looked though other threads, but I couldn't find what I want...

 

Any advice would help me greatly!

Thank you in advance, and I will not forget kudos!

Download All
0 Kudos
Message 1 of 3
(2,524 Views)

Hello kmyan9

 

If you compare A and B whether they are equal, then both values have to be exactly the same. For measured values this is not very often the case.

So, it is better to use >=. In the result of the channel event function, are the Start-Index the values you are looking for.

Greetings

Walter

Message 2 of 3
(2,491 Views)
Solution
Accepted by topic author kmyan9

 Hey Walter!

 

Thank you for your suggestion!

I did realize that A & B can almost NEVER be equal just before you posted you response.

 

Then I just managed to get it, and will post my solution for future reference.

I subtracted the two graphs, found the range at where the difference was a very small value (ex. 0.5)

Then multiplied it with the smaller graph to get another "final channel"

Then used the calculator to do

"Ch("Final") = IIF(Ch("EventStatus") = 0, NoValue, Ch("Multiplied")) 

and got the result that I attached as "got it.png"

 

Thanks for the help Walter hope you have a good day!

0 Kudos
Message 3 of 3
(2,487 Views)