Code covered by the BSD License  

Highlights from
Find Nearest Neighbors on Sphere

Be the first to rate this file! 8 Downloads (last 30 days) File Size: 13.9 KB File ID: #28844

Find Nearest Neighbors on Sphere

by

 

26 Sep 2010 (Updated )

To be used with the GridSphere function to look up the nearest point to a query on a geodesic grid.

| Watch this File

File Information
Description

A geodesic grid is an even grid over the surface of a sphere. The algorithm is optimized for a grid generated by GridSphere and won't work on an arbitrary geodesic grid. All code is compatible with GNU Octave. The GridSphere function is available on the MATLAB file exchange at http://www.mathworks.com/matlabcentral/fileexchange/28842-gridsphere.

FindNearestNeighbors and GridSphere share some functions in common. Each package contains a copy of these functions so that both can stand alone. To eliminate duplicates, simply move all the files into a single folder and replace the shared files when prompted.

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
07 Feb 2012 Paul

-- Wrong page. Comment intended for GridSphere code.

07 Feb 2012 Paul

Blazingly fast and well documented. Only an example would not have been unbecoming, e.g. to illustrate the fact that returned values are in degrees (whereas Matlab's sph2cart requires radians).

[lat,long] = GridSphere(1000);
latrad = deg2rad(lat);
longrad = deg2rad(long);
[x,y,z] = sph2cart(longrad, latrad, 1);
scatter3(x, y, z, 22);
axis equal vis3d;

Updates
27 Sep 2010

Added missing function file.

27 Sep 2010

Added missing Logarithm function file.

10 Oct 2010

Replaced the ElementWiseMax function with an equivalent built-in function.

21 May 2012

Replaced tabs with spaces so that the source code displays consistently in all text editors.

Contact us