Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Français


cshep2d

bidimensional cubic shepard (scattered) interpolation

Syntax

tl_coef = cshep2d(xyz)

Arguments

xyz

a n x 3 matrix of the (no gridded) interpolation points (the i th row given the (x,y) coordinates then the altitude z of the i th interpolation point)

tl_coef

a tlist scilab structure (of type cshep2d)

Description

This function is useful to define a 2d interpolation function when the interpolation points are not on a grid (you may use it in this case but splin2d is better for that purpose). The interpolant is a cubic shepard one and is a C2 (twice continuously differentiable) bivariate function s(x,y) such that : s(xi,yi)=zi for all i=1,..,n ((xi,yi,zi) being the i th row of xyz).

The evaluation of s at some points must be done by the eval_cshep2d function.

Remark

The function works if n>= 10, if the nodes are not all colinears (i.e. the (x,y) coordinates of the interpolation points are not on the same straight line), and if there is no duplicate nodes (i.e. 2 or more interpolation points with the same (x,y) coordinates). An error is issued if these conditions are not respected.

Examples

// interpolation of cos(x)cos(y) with randomly chosen interpolation points
n = 150; // nb of interpolation points
xy = grand(n,2,"unf",0,2*%pi);
z = cos(xy(:,1)).*cos(xy(:,2));
xyz = [xy z];
tl_coef = cshep2d(xyz);

// evaluation on a grid
m = 30;
xx = linspace(0,2*%pi,m);
[X,Y] = ndgrid(xx,xx);
Z = eval_cshep2d(X,Y, tl_coef);
clf()
plot3d(xx,xx,Z,flag=[2 6 4])
param3d1(xy(:,1),xy(:,2),list(z,-9), flag=[0 0])
xtitle("Cubic Shepard Interpolation of cos(x)cos(y) with randomly chosen interpolation points")
legends("interpolation points",-9,1)
show_window()

See also

  • splin2d — bicubic spline gridded 2d interpolation
  • eval_cshep2d — bidimensional cubic shepard interpolation evaluation

History

VersionDescription
5.4.0 previously, imaginary part of input arguments were implicitly ignored.
Report an issue
<< bsplin3val Interpolation eval_cshep2d >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:15:58 CEST 2024