angsepd

From DavinciWiki
Jump to: navigation, search

Description

Computes the angular separation (great circle distance) between two pairs of coordinates.

Arguments and Return Values

Parameters: Four inputs specifying the latitude and longitude of the points in question, in degrees.

Return Value: A value specifying the angular separation between the two points, in degrees.

Usage

Syntax: angsepd(lat1, lon1, lat2, lon2)

'lat' and 'lon' are numeric

This function is only exact (within machine precision) for points on a sphere. Planets are not perfect spheres, but treating a planet as a sphere is a sufficiently accurate approximation for most purposes.

This function should work when given array inputs, but this has not been extensively tested.

Return format is double if input is double; float otherwise

This function simply applies the formula θ = acos(cos(lat1)*cos(lat2)*cos(lon1 - lon2) + sin(lat1)*sin(lat2)) from http://mathworld.wolfram.com/GreatCircle.html

When angsepd() is entered without any arguments, it prints its description, as shown below.

Examples

dv> angsepd()

Given two pairs of coordinates, returns angular separation
angsepd(lat1, lon1, lat2, lon2)
All inputs should be in degrees. Output is in degrees.
This is the great circle distance (for a sphere).
See http://mathworld.wolfram.com/GreatCircle.html
S.Marshall 10-27-2009

0
dv> angsepd(0, 0, 45, 180)
135.000000000000
dv> angsepd(0, 0, 45, 45)
60.0000038146973
dv> angsepd(double(0), double(0), double(45), double(45))
60.0000000000000

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 11-17-2009
Modified On: 11-17-2009

Personal tools