Tuesday, March 1, 2016

Interpolation of surfaces from scattered data points (made in VB6)

This is a software made in the great Visual Basic 6.0 programming language (advanced stuff). It contains routines for interpolation of surfaces from scattered data points. It includes the "kriging" interpolation (Kriging or Gaussian process regression is a method of interpolation for which the interpolated values are modeled by a Gaussian process governed by prior covariances, as opposed to a piecewise-polynomial spline chosen to optimize smoothness of the fitted values. Under suitable assumptions on the priors, Kriging gives the best linear unbiased prediction of the intermediate values. Interpolating methods based on other criteria such as smoothness need not yield the most likely intermediate values.), with the quadratic method of Shepard and the MASUB routine.

Download from PSC

Download from me

Screen animations:

A video of this project:

Source: http://www.flanguasco.org/VisualBasic/VisualBasic.html

Instructions to use of Surfit

(Automated translation from Italian)

This project includes three routines for 'interpolation of surfaces from scattered data points. L 'interpolation is performed in correspondence with the points located on a rectangular grid with the abscissa and the order dates.

Three routines are available:

1) KTB2D: geostatistical method particularly useful when the changes from point to point are too irregular to be represented by a mathematical function. Designed originally by 'mining engineer D. G. Krige (hence the name of "kriging") and' very used to interpolations and topographic 's image analysis. For good results it is necessary to "play" with little setup parameters (structure Par).

2) MASUB: algorithm based on triangulation of data points. It allows some control over the behavior surface interpolating (or even estrapolante) but I often found errors when the ends of the grid of interpolated points coincide with some of the data points.

3) QSHEP2D: running a 'quadratic interpolation of the data points. It also allows the direct calculation of the gradient of the surface and to evaluate the interpolated value of a single point (the other two routines are always working on all the points of a grid).

The data to be interpolated can be read (File / Read data files) from a file, which must be organized as:

XD (1) YD (1) ZD (1)
XD (2) YD (2) ZD (2)
...... ...... ......
 XD (ND) YD (ND) ZD (ND)

XD (I) and YD (I) are, respectively, the x-axis and the ordinates of the 'ith known point and ZD (I) the corresponding area value.

The points, interpolated, of the surface are calculated in the ZI rectangular matrix (1 To NXI, 1 To NYI) in correspondence of the abscissa and the ordinate contained in XI carriers (1 To NXI) and YI (1 To NYI). The NXI values, NYI (default: NXI = 50, NYI = 50) can be changed using the Settings table.

The interpolated data can be saved (File / Save interpolated data) of a file, which are organized as:

XI (1) YI (1) ZI (1, 1)
XI (1) YI (2) ZI (1, 2)
....... ....... ............
 XI (1) YI (NYI) ZI (1, NYI)
XI (2) YI (1) ZI (2, 1)
....... ....... ............

The "Test" command allows you to visually assess the behavior of the three routines when applied to surfaces of Z equation (I, J) = F (X (I), Y (J)) note. The comparison is made between the surface area calculated analytically and the interpolated from a set of points generated randomly.

Note: the routines KTB2D, MASUB, QSHEP2D, Gradiente2D and CONREC are also available in the form of DLL (written in Digital Visual Fortran) recalled by VB and much more 'fast execution. Of SHEP2D also exist CSHEP2D versions (cubic interpolation) and TSHEP2D (interpolation series of cosines).
These DLLs are available on request at the author.

by F. Languasco

No comments:

Post a Comment