Data gridding and hypersurface fitting (dimension ≥ 2)
yi = griddatan(x,y,xi)
yi = griddatan(x,y,xi,method)
yi = griddatan(x,y,xi,method,options)
yi = griddatan(x,y,xi) fits
a hyper-surface of the form y = f(x) to
the data in the (usually) nonuniformly-spaced vectors (
this hyper-surface at the points specified by
xi can be nonuniform.
X is of dimension
m points in n-dimensional space.
of the hyper-surface f(
a vector of size
in the n-dimensional space whose surface value is to be fitted.
a vector of length
p approximating the values f(
The hypersurface always goes through the data points (
usually a uniform grid (as produced by
yi = griddatan(x,y,xi,method) defines
the type of surface fit to the data, where
|Triangulation-based linear interpolation (default).||C0|
|Nearest neighbor interpolation.||Discontinuous|
All the methods are based on a Delaunay triangulation of the data.
, the default
yi = griddatan(x,y,xi,method,options) specifies
a cell array of strings
options to be used in Qhull
default options are used. If
no options are used, not even the default.
X = 2*gallery('uniformdata',[5000 3],0)-1; Y = sum(X.^2,2); d = -0.8:0.05:0.8; [y0,x0,z0] = ndgrid(d,d,d); XI = [x0(:) y0(:) z0(:)]; YI = griddatan(X,Y,XI);
Since it is difficult to visualize 4-D data sets, use isosurface at 0.8:
YI = reshape(YI, size(x0)); figure p = patch(isosurface(x0,y0,z0,YI,0.8)); isonormals(x0,y0,z0,YI,p) p.FaceColor = 'blue'; p.EdgeColor = 'none'; view(3) axis equal camlight lighting phong