Home > hfrc > matlab > utility > dist.m

# dist

## PURPOSE DIST - computes distance in between points in euclidean space.

## SYNOPSIS function d = dist( x1, y1, x2, y2 )

## DESCRIPTION ``` DIST - computes distance in between points in euclidean space.

Usage: d = dist( x1, y1, x2, y2 )
d = dist( x1, x2 )

For the first form, x1 and y1 must have the same size.  The same goes
for x2 and y2.  x1 and x2 can either have the same size, or one can be a
row vector and the other a column vector. In the prior case, the
Euclidean distance in the plane is calculated between [x1,y1] and
[x2,y2].  In the second case, the distance between all possible point
pairs is calculated (ie. if x1 is a row vector of length N and x2 is a
column vector of length M, the result will be a matrix of size NxM with
the distance between all possible combinations of [x1, y1] and [x2,y2].

The second case is computationally equivalent to
d = dist( x1, 0 * x1, x2, 0 * x2 )
and is a slow, but legitimate way of computing distance on the line.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\$Id: dist.m,v 1.4 2003-04-02 01:00:45 dmk Exp \$

Copyright (C) 2001 David M. Kaplan
Licence: GPL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%```

## CROSS-REFERENCE INFORMATION This function calls:
• end END - basic end method for HFRC objects.
• size SIZE - returns [ (num times), (num gridpts) ].
This function is called by:
• density DENSITY - Calculates the spatial density of grid points around a
• diff DIFF - This function tries to differentiate the variables in
• particle_track_2nd_largeGrid PARTICLE_TRACK_2D_LARGEGRID - track the movement of one or more particles
• sortS SORTS - this function sorts data rows of an HFRC object
• distance_bar Usage: [bar_handle, text_handle, location] = distance_bar( distance, location )
• lonlat2dist LONLAT2DIST - computes distance in kms between points.
• m_distance_bar Usage: [bar_handle, text_handle, location] = m_distance_bar( distance, ...
• mindist MINDIST - computes minimum distances between points.

Generated on Mon 18-Dec-2006 07:26:46 by m2html © 2003