ocmath_2d_kriging_scat

 

Description

This function perform 2d surface fitting using Kriging algorithm.

Syntax

int ocmath_2d_kriging_scat( int npts, const double* x, const double* y, const double* z, int noctMin, double radius, double dSmooth, int nEvalPTS, const double* pX, const double* pY, double* pZ, int noctMax = -1 );

Parameters

npts
[Input]the number of given points
x
[Input]the x position and value of each given point
y
[Input]the y position and value of each given point
z
[Input]the z position and value of each given point
noctMin
[Input]the minimum points in each quarter, if the number of points
in any quarter is less than noctMin, the search radius will be enlarged.
radius
[Input]the search radius in the unit of 2 * Mean-distance-of-any-two-given-points.
It means that, the z-value of the unknown points will be evaluated using about
(2 * radius * 2)^2 points.
dSmooth
[Input]the parameter in the power semivariogram.
nEvalPTS
[Input]the number of points to be evaluated.
pX
[Input]the x position of the points to be evaluated.
pY
[Input]the y position of the points to be evaluated.
pZ
[Output]the evaluated value.
noctMax
[Input]the maximun points in each quarter, if the number of points in any quarter is larger than noctMax, the search will be stopped.

Return

Examples

EX1

#include <wks2mat.h>
void ocmath_2d_kriging_scat_ex1()
{
    int i, j, m, n, nx, ny;
    double xhi, xlo, yhi, ylo;

    nx = 20;
    ny = 20;
    xlo = 0.0;
    ylo = 0.0;
    xhi = 1.0;
    yhi = 1.0;

    double x[400], y[400], f[400];
    
    m = 0;
      for (j=0; j<ny; ++j)
    {
        for (i=0; i<nx; ++i)
        {
            x[m] = (1.0 * (nx-i-1) / (nx-1)) * xlo + (1.0*i / (nx-1)) * xhi;
            y[m] = (1.0 * (ny-j-1) / (ny-1)) * ylo +    (1.0* j / (ny-1)) * yhi;
            f[m]= x[m]*x[m]+y[m]*y[m]+x[m]*y[m];
            ++m;
        }
    }
    
    double pf[10000], px[10000], py[10000];

    n=0;
    nx = 100;
    ny = 100;
    for (j=0; j<ny; ++j)
    {
        for (i=0; i<nx; ++i)
        {
            px[n] = (1.0 * (nx-i-1) / (nx-1)) * xlo + (1.0*i / (nx-1)) * xhi +0.0005;
            py[n] = (1.0 * (ny-j-1) / (ny-1)) * ylo +    (1.0* j / (ny-1)) * yhi;
            ++n;
        }
    }

    int nret;
    nret = ocmath_2d_kriging_scat(m, x, y, f, 3, 2, 1.8, n, px, py, pf);
        printf("nret = %d\n",nret);

}

Remark

See Also

header to Include

wks2mat.h

Reference