Home > atmlab > geographical > grid2edges.m

grid2edges

PURPOSE ^

GRID2EDGES Estimates grid edges for a set of grid points.

SYNOPSIS ^

function e = grid2edges(g)

DESCRIPTION ^

 GRID2EDGES   Estimates grid edges for a set of grid points.

    Between defined grid points, the edge is defined as the middle point. 
    End edges are set based on the distance between the two closest points.

 FORMAT   e = grid2edges(g)
        
 OUT   e   Edges of grid ranges.
 IN    g   Grid points.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

grid2edges.m

SOURCE CODE ^

0001 % GRID2EDGES   Estimates grid edges for a set of grid points.
0002 %
0003 %    Between defined grid points, the edge is defined as the middle point.
0004 %    End edges are set based on the distance between the two closest points.
0005 %
0006 % FORMAT   e = grid2edges(g)
0007 %
0008 % OUT   e   Edges of grid ranges.
0009 % IN    g   Grid points.
0010 
0011 % 2006-03-27   Created by Patrick Eriksson.
0012 
0013 function e = grid2edges(g)
0014 
0015 
0016 %= Fix to make sure that column or row vector shape is preserved
0017 %
0018 e        = g;
0019 e(end+1) = 0;
0020 
0021 
0022 e(1)       = g(1)-(g(2)-g(1))/2;
0023 e(2:end-1) = edges2grid(g);
0024 e(end)     = g(end)+(g(end)-g(end-1))/2;

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005