griddata

griddata creates a regular grid of arbitrarily distributed data triples.

rmZi = griddata(rvX, rvY, rvZ, rvXi, rvYi)
rmZi = griddata(rvX, rvY, rvZ, rvXi, rvYi, nOption)
rmZi = griddata(rvX, rvY, rvZ, rvXi, rvYi, ssOption)

Return Value

rmZi is the interpolated z value matrix for the given rvXi and rvYi coordinates. In case of an error rmZi is an error object (see example).

Parameters

rvX

rvX is a real vector with at least 4 elements.

rvY

rvY is a real vector with at least 4 elements. The number of points must be identical with rvX.

rvZ

rvZ is a real vector with at least 4 elements. The number of points must be identical with rvX.

rvXi

rvXi is a real vector with at least one point.

rvYi

rvYi is a real vector with at least one point.

ssOption

See nOption.

nOption

Is one of the following values:

ssOption nOption  
“linear” 1 Linear interpolation.
“cubic” 2 cubic spline interpolation.
“tps” oder “thin-plate-spline” 3 Thin-Plate-Spline interpolation.
“poly1” or “plane” 4  
“poly2” 5  
“poly3” 6  
“interp1d-bilinear” 7  

Example

If an error occurred, griddata returns an error object (see also error_create).

def test_griddata()
{
    srand(1);
    x = rand(100, 1)*15-7.5;
    y = rand(100, 1)*15-7.5;
    r = sqrt(x.*x + y.*y);
    z = sin(r)./r;
    xi = linspace(-7.5, 7.5, 40)
    yi = xi;
    zi = griddata(x, y, z, xi, yi, "thin-plate-spline");
    if (type(zi) == "error") {
        MessageBoxError(zi.message);
        return FALSE;
    }
    plotxyz(xi, yi, zi);
    return TRUE;
}

History

Version Description
5.20 New.

id-1546570