function distance = dist2d(x1, y1, x2, y2) % dist2d(x1, y1, x2, y2) -- compute 2-D distances % % A two-dimensional distance computation algorithm. % Given any set of X's and Y's this % function will tell you the 2-D distance between the two. % % Example: % dist2d(x,y, x0, y0) distance = sqrt( (x1 -x2)^2 + (y1 - y2)^2 );