distance_to_position_sphere, a MATLAB code which estimates the positions of cities given a city-to-city distance table. The cities are presumed to lie on a sphere, and to be sufficiently separated that the curvature of the sphere must be accounted for.
The problem is singular. In particular, the position of one city is completely arbitrary, and one component of a second city is completely arbitrary (and a third city's position can be "flipped" about the line connecting cities one and two). To remove some of this singularity, the program assigns city #1 to have latitude and longitude 0, and city #2 is given a longitude of 0.
Once the nonlinear least squares problem is set up, MATLAB's LSQNONLIN function is called to seek a solution.
Note that if the cities are all in a relatively small area, it may be reasonable to treat the problem as though it were posed on a plane.
If your data is on the earth, note that the average radius of the earth is 3,959 miles or 6,371 kilometers.
The selection of MATLAB's LSQNONLIN function for use as the solver, the construction of the appropriate anonymous function, and the setting of the options for LSQNONLIN were devised by Gene Cliff, to whom grateful acknowledgement is made.
distance_to_position_sphere ( 'distance.txt', radius )where
The computer code and data files described and made available on this web page are distributed under the MIT license
distance_to_position_sphere is available in a MATLAB version.
cities, a dataset directory which contains sets of information about cities and the distances between them;
cities, a MATLAB code which handles various problems associated with a set of "cities" on a map.
distance_to_position, a MATLAB code which estimates the positions of a number of cities based on a table of city-to-city distances, assuming Euclidean geometry.
distance_to_position_sphere_test
partial_digest, a MATLAB code which solves the partial digest problem.