M-File Help: distance View code for distance

distance

Euclidean distances between sets of points

d = distance(a,b) is the Euclidean distances between L-dimensional points described by the matrices a (LxM) and b (LxN) respectively. The distance d is MxN and element d(I,J) is the distance between points a(I) and d(J).

Example

A = rand(400,100); B = rand(400,200);
d = distance(A,B);

Notes

||A-B|| = sqrt ( ||A||^2 + ||B||^2 - 2*A.B )

Author

Roland Bunschoten, University of Amsterdam, Intelligent Autonomous Systems (IAS) group, Kruislaan 403 1098 SJ Amsterdam, tel.(+31)20-5257524, bunschot@wins.uva.nl Last Rev: Oct 29 16:35:48 MET DST 1999, Tested: PC Matlab v5.2 and Solaris Matlab v5.3, Thanx: Nikos Vlassis.

See also

closest


 

© 1990-2012 Peter Corke.