This problem has issues. The coordinates of the cities are wrong. (Correct values can be taken from Google maps). New York's location is at 40.7128, -74.0059 and not 40.7128, 74.0059. The distance between Berlin and London is too close to its harvesine distance (which considers Earth's curvature; and the pythagorean distance cannot possible be that close). And that makes me believe that the author used different methods to calculate the distances between different cities. Moreover, the problem should explain what it is the precision required, if pi should be used with its exact value, if the Earth should be considered as an ellipsoid or an sphere. and finally which method must be used to convert from lat/long to cartesian coordinates (or at least, a hint). Please fix the problem description and the test suite whenever possible.
Make the vector [1 2 3 4 5 6 7 8 9 10]
Replace Vector Elements
Getting the indices from a matrice
Unique values without using UNIQUE function
Switch matrix to a column vector
Persistence will help you solve almost any problem.
microseconds passed today
Find index of a string in a cell array
calculate the day of the year from a date string.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office