Suppose, you need to calculate distance between two locations on Earth in kilometers. And suppose you know their geographical coordinates, i.e. [latitude, longitude]. In MatLab there is a function *distance(lat1, lon1, lat2, lon2)*. It calculates distance between two points in angle units (in degrees there). So, you can calculate distance between two objects in angle units. Next you should to convert angle units into kilometers. Use for this *distdim(angle,’deg’,’kilometers’) *function.

For example you need to find distance between Minsk, Belarus (53.9, 27,5667 [53° 54′ 0″ N, 27° 34′ 0″ E]) and Caracas, Venezuela (10.5207, -66.9245 in [10° 31′ 14.52″ N, 66° 55′ 28.2″ W]).

Type:

>> distdim(distance(53.9, 27.5667, 10.5207, -66.9245),'deg','kilometers')

Result will be 9355.484 kilometers.