topic Measure distance between all points in Discussions
https://community.jmp.com/t5/Discussions/Measure-distance-between-all-points/m-p/181187#M40248
<P>I am trying to determine a meausre of how distance from a point effects measurements to find a minimum / maximum point within range of points. </P><P> </P><P>I tried to do this in the attached files but I cannot find a way to do this programatically. I tried to do this by concatenating a table of N rows, N times, copying the XY coulmn, sorting Y then X then pastingn this sorted column into the NxN table.</P><P> </P><P>I tried to do this with EVAL / SUBSTITUTION but cannot get it to successfuly execute.</P>Fri, 01 Mar 2019 20:54:45 GMTJumpingAC2019-03-01T20:54:45ZMeasure distance between all points
https://community.jmp.com/t5/Discussions/Measure-distance-between-all-points/m-p/181187#M40248
<P>I am trying to determine a meausre of how distance from a point effects measurements to find a minimum / maximum point within range of points. </P><P> </P><P>I tried to do this in the attached files but I cannot find a way to do this programatically. I tried to do this by concatenating a table of N rows, N times, copying the XY coulmn, sorting Y then X then pastingn this sorted column into the NxN table.</P><P> </P><P>I tried to do this with EVAL / SUBSTITUTION but cannot get it to successfuly execute.</P>Fri, 01 Mar 2019 20:54:45 GMThttps://community.jmp.com/t5/Discussions/Measure-distance-between-all-points/m-p/181187#M40248JumpingAC2019-03-01T20:54:45ZRe: Measure distance between all points
https://community.jmp.com/t5/Discussions/Measure-distance-between-all-points/m-p/181205#M40249
<P>Did you see the Distance() function? Here is an example from the Scripting Index of a script using it:</P>
<P> </P>
<PRE><CODE class=" language-jsl">Names Default To Here( 1 );
/*1-D example*/
exX1 = [1, 2, 3, 4];
exX2 = [2, 4, 6, 8];
/*Compute squared Euclidean distance*/
exD = Distance( exX1, exX2 );
/*Verify result*/
exDm = J( 4, 4, . );
For( exi = 1, exi <= 4, exi++,
For( exj = 1, exj <= 4, exj++,
exDm[exi, exj] =
Sum( (exX1[exi, 0] - exX2[exj, 0]) ^ 2 )
)
);
Show( exDm == exD );
/*2-D example*/
exX1 = [1 1, 2 2, 3 3, 4 4];
exX2 = [2 1, 4 2, 6 0, 8 7];
/*Compute squared Euclidean distance*/
exD = Distance( exX1, exX2 );
/*Verify result*/
exDm = J( 4, 4, . );
For( exi = 1, exi <= 4, exi++,
For( exj = 1, exj <= 4, exj++,
exDm[exi, exj] =
Sum( (exX1[exi, 0] - exX2[exj, 0]) ^ 2 )
)
);
Show( exDm == exD );
/*2-D example*/
exX1 = [1 1, 2 2, 3 3, 4 4];
exX2 = [2 1, 4 2, 6 0, 8 7];
/*Compute squared Euclidean distance, with a scaler [0.5 2.0]*/
exD = Distance( exX1, exX2, [0.5 2.0] );
/*Verify result*/
exDm = J( 4, 4, . );
For( exi = 1, exi <= 4, exi++,
For( exj = 1, exj <= 4, exj++,
exDm[exi, exj] =
Sum(
[0.5 2.0] :* (
Abs( exX1[exi, 0] - exX2[exj, 0] ) ^ 2)
)
)
);
Show( exDm == exD );
/*2-D example*/
exX1 = [1 1, 2 2, 3 3, 4 4];
exX2 = [2 1, 4 2, 6 0, 8 7];
/*Compute squared Euclidean distance, with scalers [0.5 2.0] and powers [1.5 2.0]*/
exD = Distance( exX1, exX2, [0.5 2.0], [1.5 2.0] );
/*Verify result*/
exDm = J( 4, 4, . );
For( exi = 1, exi <= 4, exi++,
For( exj = 1, exj <= 4, exj++,
exDm[exi, exj] =
Sum(
[0.5 2.0] :* (
Abs( exX1[exi, 0] - exX2[exj, 0] ) :^ [
1.5 2.0])
)
)
);
Show( exDm == exD );</CODE></PRE>Fri, 01 Mar 2019 20:58:48 GMThttps://community.jmp.com/t5/Discussions/Measure-distance-between-all-points/m-p/181205#M40249markbailey2019-03-01T20:58:48Z