TWODSORT is the jMap module of jLab.

 TWODSORT  Distances from data points to nearby grid points.
 
    [D,XD,YD]=TWODSORT(X,Y,XO,YO,CUTOFF) returns distances D between data
    points at locations X,Y and nearby grid points at XO,YO, computed
    efficiently and organized in a convenient manner.
 
    XD and YD are deviations from each data point location to the grid 
    point location. CUTOFF is the maximum distance for which we wish the
    output arrays to be returned.
  
    X and Y are arrays of the same size into data point locations. XO and
    YO  are arrays of length M and N, say, specifying the bin center
    locations of an M x N matrix of grid points, i.e.
 
        XO =  [XO_1;    YO= [YO_1 YO_2 ... YO_N]. 
               XO_2; 
                ...
               XO_M]
 
    The output arrays are then each M x N x P arrays of column vectors, 
    where P is the maximum number of points in the CUTOFF neighborhood at
    any grid point.  Points farther away are filled with NANs.
 
    D gives the distances of those data points less than CUTOFF from the
    (m,n)th grid point, sorted in order of increasing distance.  XD and YD 
    are deviations of each data point from the (m,n)th grid point location.
    _________________________________________________________________
  
    Additional input parameters
 
    Let's say some additional variables Z1, Z2,...,ZK are given at the data
    locations X,Y.  Then 
    
    [D,XD,YD,Z1D,Z2D,...,ZKD]=
 
                 TWODSORT(X,Y,Z1,Z2,...,ZK,XO,YO,CUTOFF);
 
    also returns the values of these variables.
 
    Z1D, Z2D,...,ZKD are the same size as the other output arguments.  Z1D
    then gives the value of Z1 at data points no more than CUTOFF 
    kilometers from the (m,n)th grid point, etc.
 
    To output an index into the data point locations, use
   
    [D,X,Y,INDEX]= TWODSORT(X,Y,[1:LENGTH(X(:))],XO,YO,CUTOFF).
    _________________________________________________________________
  
    See also SPHERESORT, POLYSMOOTH.
 
    'twodsort --t' runs a test.
 
    Usage: [ds,xs,ys]=twodsort(x,y,xo,yo,cutoff);
           [ds,xs,ys,zs]=twodsort(x,y,zs,xo,yo,cutoff);
           [xs,ys,z1s,z2s,...,zNs]=twodsort(x,y,z1,z2,...,zN,xo,yo,cutoff);
    __________________________________________________________________
    This is part of JLAB --- type 'help jlab' for more information
    (C) 2008--2015 J.M. Lilly --- type 'help jlab_license' for details

contents | allhelp | index