griddatan
Interpolates scattered data in N dimensions.
Category: Mathematics > Interpolation
Syntax
yi = griddatan(X, y, xi)
Linear interpolation of the values y sampled at the rows of X, evaluated at the rows of xi.
yi = griddatan(X, y, xi, method)
Chooses the method, 'linear' or 'nearest'.
Description
griddatan is the N-dimensional counterpart of griddata. It triangulates the sample points (into simplices) and interpolates linearly inside the simplex that contains each query point.
Because the points are given as rows of one matrix, the dimension is taken from the number of columns of X rather than from the number of arguments.
Input arguments
X- m-by-n matrix; each row is a sample point in n dimensions.
y- Column vector of m sample values.
xi- p-by-n matrix of query points, one per row.
Output arguments
yi- Column vector of p interpolated values;
NaNfor points outside the convex hull.
Example
Four corners of a square
X = [0 0; 1 0; 0 1; 1 1];
v = [0; 1; 2; 3];
griddatan(X, v, [0.25 0.25; 0.5 0.5])
Output
ans = 2×1
0.7500
1.5000