Publisher review:nearestneighbour computes nearest neighbour(s) by Euclidean distance nearestneighbour computes the nearest k neighbours to a set of points of interest from a set of candidate points by Euclidean Distance. Points are considered to be columns of a 2D matrix. The points of interest can be specified as indices into the candidate points, or as a separate matrix of points.Points can be of any (within reason) dimension.If only 1 neighbour is required for each point of interest, nearestneighbour tests to see whether it would be faster to construct the Delaunay Triangulation (delaunayn) and use dsearchn to lookup the neighbours, and if so, automatically computes the neighbours this way. This means the fastest neighbour lookup method is always used.A couple of examples:% Candidate pointsX = rand(2, 100);% Points of interestP = rand(2, 3);% Find the nearest neighbour to each column of P% where X(:, I(i)) is the neighbour to P(:,i)I = nearestneighbour(P, X)% Find the nearest 10 neighbours to each column of PI = nearestneighbour(P, X, 'NumberOfNeighbours', 10)% Find the nearest neighbours to the 2nd and 20th points in XI = nearestneighbour([2 20], X)% Find the nearest neighbours to all columns of XI = nearestneighbour(X) Requirements: ยท MATLAB Release: R14SP3
nearestneighbour is a Matlab script for Mathematics scripts design by Richard Brown.
It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.
Operating system:Windows / Linux / Mac OS / BSD / Solaris