这个问题我曾经作过。当然最好的网格化方法的是克立金方法,
这是数学地质中一种著名的插值方法,其算法本身而言,Surf的帮助中有较详细的说明。
但是因为涉及到一些统计量的计算,因此这种方法比较难于实现。还有一种简单的方法叫
反比半径法,这种方法的原理是已知点对估计点的影响随其距离的增加而单调递减。这种方法
非常简单,我就是用这种方法做的,但是其效果不是很好,在数据比较少的情况下。Surfur
中也有这种算法计算网格数据。当然还有许多别的算法,但效果都不如克立金。
以前我曾经下载过一个Fortran语言编制的网格数据生成的动态链接库,
可惜他用文件进行数据交换,我现在一时找不到了。过一段时间我会重新编制这方面的程序
,我将使用FORTRAN商业算法集IMSL中现有的函数SURF/DSURF 函数,其说明如下:
SURF/DSURF (Single/Double precision)
Compute a smooth bivariate interpolant to scattered data that is locally a quintic
polynomial in two variables.
Usage
CALL SURF (NDATA, XYDATA, FDATA, NXOUT, NYOUT, XOUT, YOUT,
SUR, LDSUR)
Arguments
NDATA — Number of data points. (Input)
NDATA must be at least four.
XYDATA — A 2 by NDATA array containing the coordinates of the interpolation
points. (Input)
These points must be distinct. The x-coordinate of the I-th data point is stored in
XYDATA(1, I) and the y-coordinate of the I-th data point is stored in XYDATA(2,
I).
FDATA — Array of length NDATA containing the interpolation values. (Input)
FDATA(I) contains the value at (XYDATA(1, I), XYDATA(2, I)).
NXOUT — The number of elements in XOUT. (Input)
NYOUT — The number of elements in YOUT. (Input)
XOUT — Array of length NXOUT containing an increasing sequence of points.
(Input)
These points are the x-coordinates of a grid on which the interpolated surface is to
be evaluated.
YOUT — Array of length NYOUT containing an increasing sequence of points.
(Input)
These points are the y-coordinates of a grid on which the interpolated surface is to
be evaluated.
SUR — Matrix of size NXOUT by NYOUT. (Output)
This matrix contains the values of the surface on the XOUT by YOUT grid, i.e.
SUR(I, J) contains the interpolated value at (XOUT(I), YOUT(J)).
LDSUR — Leading dimension of SUR exactly as specified in the dimension
statement of the calling program. (Input)
LDSUR must be at least as large as NXOUT.
Comments
1. Automatic workspace usage is
SURF 31 * NDATA + NXOUT * NYOUT + 6 * NDATA units, or
DSURF 31 * NDATA+ NXOUT * NYOUT + 12 * NDATA units.
Workspace may be explicitly provided, if desired, by use of
S2RF/DS2RF. The reference is
CALL S2RF (NDATA, XYDATA, FDATA, NXOUT, NYOUT, XOUT,
YOUT, SUR, LDSUR, IWK, WK)
The additional arguments are as follows:
IWK — Work array of length 31 * NDATA + NXOUT * NYOUT.
WK — Work array of length 6 * NDATA.
2. Informational errors
Type Code
4 5 The data point values must be distinct.
4 6 The XOUT values must be strictly increasing.
4 7 The YOUT values must be strictly increasing.
3. This method of interpolation reproduces linear functions.
Algorithm
This routine is designed to compute a C interpolant to scattered data in the
plane. Given the data points
x y f in i i i i
N , , 1 6 < A=1
SURF returns (in SUR, the user-specified grid) the values of the interpolant s. The
computation of s is as follows: First the Delaunay triangulation of the points
x y i i i
N , 1 6 < A=1
is computed. On each triangle T in this triangulation, s has the form
s x y c x y x y T
m n
mn
T m n , , 05= &aring; " &Icirc;
+ &pound;5
Thus, s is a bivariate quintic polynomial on each triangle of the triangulation. In
addition, we have
s(xL, yL) = fL for i = 1, &frac14;, N
and s is continuously differentiable across the boundaries of neighboring
triangles. These conditions do not exhaust the freedom implied by the above
representation. This additional freedom is exploited in an attempt to produce an
interpolant that is faithful to the global shape properties implied by the data. For
more information on this routine, we refer the reader to the article by Akima
(1978). The grid is specified by the two integer variables NXOUT, NYOUT that
represent, respectively, the number of grid points in the first (second) variable
and by two real vectors that represent, respectively, the first (second) coordinates
of the grid.
从说明来看这个算法好性不是克立金法。也不知道效果到底怎么样