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: 

Minimum Distance between Two curves on a X-Y plane

Is there any inbuilt DIAdem function/command to find out the minimum distance between two curves on a 2 D Axis plot? If so, what is it? Otherwise please suggest me the best method to get the value.
0 Kudos
Message 1 of 7
(4,603 Views)
Hi,

I hope the following script can help you:


sResultChn = MyResultChn
sTimeChn = MyTimeChn

call FormulaCalc("Ch('ChnRes'):= Abs(Ch('[1]/Geschwindigkeit')-Ch('[1]/Drehmoment'))")
iMinValue = ChnPropGet(sResultChn, "minimum")
iPosOfMinValue = pno(sResultChn, iMinValue)
sValOfTimeChn = chd(iPosOfMinValue, sTimeChn) 


Greetings
Walter
0 Kudos
Message 2 of 7
(4,595 Views)

Do you refer to the distance in Y direction only ? Or do you refer to the distance in the xy-plane ?

Andreas

P.S. If its the distance in Y-direction than Walters answer is a perfect fit

0 Kudos
Message 3 of 7
(4,583 Views)
Hi Andreas,
   Yes, I meant only in the Y direction. Thanks a lot.
Regards,
Venkatesh
0 Kudos
Message 4 of 7
(4,576 Views)
Hi Walter,
 Thanks for your instant reply. I have a problem though - one set of Y values(array 1, say) has only 4 or 5 points(not a smooth curve) while the other(array 2, say) has 101 points, though both are plotted to the same X-Y scales.  Hence I need to subtract only values corresponding to those 4 or 5 points of array 1. So I cannot pick up the values from the two arrays one to one. How do I do it then?
Regards,
Venkatesh.
0 Kudos
Message 5 of 7
(4,575 Views)
Hi Venkatesh,

In that case you must map the longer channel to the smaller one. You can do that with the "Linear mapping" function in the toolbar "Curve fitting". X and Y channel are the long channels and the "Interpolation channel" is the X channel from the smaller one. After that you can use the script above.



Greetings
Walter
0 Kudos
Message 6 of 7
(4,569 Views)
Hi Walter,
     Thanks a lot for your suggestions. The script works perfectly after the linear mapping, and my problem has been solved.
Warm regards,
Venkatesh.
0 Kudos
Message 7 of 7
(4,537 Views)