07-Jan-2022 19:05:58 DISTANCE_TO_POSITION_TEST(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test DISTANCE_TO_POSITION(). 07-Jan-2022 19:05:58 DISTANCE_TO_POSITION(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Read a distance table for N points or cities; assign coordinates to each point which will reproduce the distance table with the lowest discrepancy, in the least squares sense. Read the header of "chain_letter_distance.txt". Spatial dimension M = 2 Number of points N = 11 Read the data in "chain_letter_distance.txt". 5 by 5 portion of distance table: Col: 1 2 3 4 5 Row 1 0 9.05 9.4 9.15 6.7 2 9.05 0 9 7.25 10 3 9.4 9 0 8 8.75 4 9.15 7.25 8 0 8.25 5 6.7 10 8.75 8.25 0 Norm of First-order Iteration Func-count f(x) step optimality 0 23 6228.73 78.5 1 46 2599.67 10 62.7 2 69 564.439 19.882 14.5 3 92 435.452 6.31721 5.63 4 115 393.14 4.90361 5.28 5 138 365.613 5.51828 4.47 6 161 350.909 3.8758 2.22 7 184 346.931 1.79046 1.31 8 207 345.006 0.986377 1.06 9 230 343.346 0.75289 1.01 10 253 341.744 0.67199 1.04 11 276 340.2 0.614415 1.13 12 299 338.663 0.565113 1.3 13 322 336.91 0.5642 1.63 14 345 334.367 0.704623 2.17 15 368 330.099 1.05771 2.6 16 391 324.799 1.40369 2.08 17 414 321.402 1.24684 1.12 18 437 319.895 0.786664 0.815 19 460 319.25 0.443778 0.534 20 483 318.985 0.251331 0.324 21 506 318.88 0.1474 0.188 22 529 318.839 0.0911569 0.108 23 552 318.823 0.0596092 0.0613 24 575 318.817 0.0405056 0.0366 25 598 318.814 0.0279868 0.0236 26 621 318.813 0.0193812 0.0153 27 644 318.812 0.0133693 0.00996 28 667 318.812 0.00916015 0.00651 29 690 318.812 0.00624103 0.00427 30 713 318.812 0.00422683 0.0028 31 736 318.812 0.00285063 0.00185 32 759 318.812 0.00191744 0.00122 33 782 318.812 0.00128456 0.000804 34 805 318.812 0.000859889 0.000532 35 828 318.812 0.000576125 0.000352 36 851 318.812 0.0003836 0.000233 37 874 318.812 0.000257799 0.000154 38 897 318.812 0.000169782 0.000102 39 920 318.812 0.000112606 6.78e-05 Local minimum possible. lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance. Least squares residual for solution is 1.785530e+01 Computed positions: Row: 1 2 Col 1 0.000000 0.000000 2 -12.181947 -0.000000 3 -9.961998 -4.056452 4 -5.883662 -1.284657 5 -0.512020 -3.443603 6 -9.095534 1.974867 7 4.201528 8.377656 8 -4.323303 -8.118434 9 -7.766161 11.021080 10 -2.816153 9.589192 11 -5.318944 -0.351155 5 by 5 portion of computed distance table: Col: 1 2 3 4 5 Row 1 0 12.1819 10.7562 6.02228 3.48146 2 12.1819 0 4.62417 6.42797 12.1674 3 10.7562 4.62417 0 4.93109 9.46983 4 6.02228 6.42797 4.93109 0 5.78926 5 3.48146 12.1674 9.46983 5.78926 0 Wrote the position data to "chain_letter_distance.coord.txt". Saved the coordinate plot in "chain_letter_distance.png" DISTANCE_TO_POSITION Normal end of execution. 07-Jan-2022 19:06:03 07-Jan-2022 19:06:03 DISTANCE_TO_POSITION(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Read a distance table for N points or cities; assign coordinates to each point which will reproduce the distance table with the lowest discrepancy, in the least squares sense. Read the header of "grid04_dist.txt". Spatial dimension M = 2 Number of points N = 4 Read the data in "grid04_dist.txt". 5 by 5 portion of distance table: Col: 1 2 3 4 Row 1 0 3 5 4 2 3 0 3.16228 5 3 5 3.16228 0 4.12311 4 4 5 4.12311 0 Norm of First-order Iteration Func-count f(x) step optimality 0 9 82.225 11.1 1 18 24.3951 10.7822 5.15 2 27 6.43679 3.5998 0.558 3 36 6.13324 0.688109 0.104 4 45 6.10184 0.363572 0.103 5 54 6.08544 0.322189 0.0762 6 63 6.07239 0.299429 0.0761 7 72 6.05883 0.311377 0.0814 8 81 6.04147 0.361026 0.0992 9 90 6.01348 0.473114 0.139 10 99 5.95508 0.72362 0.23 11 108 5.81283 1.37783 0.468 12 117 5.81283 3.68806 0.468 13 126 5.4041 0.922014 0.486 14 135 4.46802 1.84403 0.633 15 144 4.46802 3.68806 0.633 16 153 3.40143 0.922014 0.573 17 162 2.34211 1.84403 0.538 18 171 2.34211 3.68806 0.538 19 180 1.60397 0.922014 0.24 20 189 0.94614 1.84403 0.55 21 198 0.94614 3.77602 0.55 22 207 0.429113 0.922014 0.198 23 216 0.2278 1.84403 0.461 24 225 0.00163706 0.659919 0.0394 25 234 5.4743e-09 0.0333706 7.15e-05 26 243 9.06261e-14 6.76938e-05 4.74e-10 27 252 9.06259e-14 5.44715e-10 8.25e-15 Local minimum found. Optimization completed because the size of the gradient is less than the value of the optimality tolerance. Least squares residual for solution is 3.010414e-07 Computed positions: Row: 1 2 Col 1 -0.000000 0.000000 2 -3.000000 0.000000 3 -4.000000 2.999999 4 -0.000000 4.000000 5 by 5 portion of computed distance table: Col: 1 2 3 4 Row 1 0 3 5 4 2 3 0 3.16228 5 3 5 3.16228 0 4.12311 4 4 5 4.12311 0 Wrote the position data to "grid04_dist.coord.txt". Saved the coordinate plot in "grid04_dist.png" DISTANCE_TO_POSITION Normal end of execution. 07-Jan-2022 19:06:03 07-Jan-2022 19:06:03 DISTANCE_TO_POSITION(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Read a distance table for N points or cities; assign coordinates to each point which will reproduce the distance table with the lowest discrepancy, in the least squares sense. Read the header of "p01_d.txt". Spatial dimension M = 2 Number of points N = 15 Read the data in "p01_d.txt". 5 by 5 portion of distance table: Col: 1 2 3 4 5 Row 1 0 29 82 46 68 2 29 0 55 46 42 3 82 55 0 68 46 4 46 46 68 0 82 5 68 42 46 82 0 Norm of First-order Iteration Func-count f(x) step optimality 0 31 232706 552 1 62 201611 10 566 2 93 147398 20 466 3 124 72988 40 245 4 155 40200.6 80 89 5 186 40200.6 160 89 6 217 32861.6 40 59.2 7 248 31972.6 80 79.1 8 279 29087.5 80 82.1 9 310 27121.6 80 92.1 10 341 21054.8 80 113 11 372 19468.9 114.16 127 12 403 9533.8 28.54 75.1 13 434 7757.8 23.0719 33.5 14 465 5904.69 9.34919 99.1 15 496 376.47 33.7885 31.3 16 527 12.1263 6.96007 0.909 17 558 11.9389 0.16408 0.00517 18 589 11.9389 0.00180985 0.000107 19 620 11.9389 3.02758e-05 1.92e-06 20 651 11.9389 2.6876e-05 2.37e-07 Local minimum possible. lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance. Least squares residual for solution is 3.455275e+00 Computed positions: Row: 1 2 Col 1 -0.000001 -0.000000 2 -28.873287 -0.000000 3 -79.291579 -21.403333 4 -14.657738 -43.389550 5 -64.747262 21.898169 6 -29.058469 -43.216730 7 -72.078533 0.181581 8 -36.036649 -21.613549 9 -50.480839 7.374471 10 -50.585903 -21.588198 11 -0.135820 -28.729290 12 -65.086564 -36.062471 13 -21.498327 7.319415 14 -57.568724 -43.250558 15 -43.070027 14.554838 5 by 5 portion of computed distance table: Col: 1 2 3 4 5 Row 1 0 28.8733 82.1295 45.7985 68.3501 2 28.8733 0 54.7732 45.6589 42.0294 3 82.1295 54.7732 0 68.271 45.6788 4 45.7985 45.6589 68.271 0 82.2888 5 68.3501 42.0294 45.6788 82.2888 0 Wrote the position data to "p01_d.coord.txt". Saved the coordinate plot in "p01_d.png" DISTANCE_TO_POSITION Normal end of execution. 07-Jan-2022 19:06:04 DISTANCE_TO_POSITION(): Normal end of execution. 07-Jan-2022 19:06:04