Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

griddata3 - Data gridding and hypersurface fitting for 3-D data

griddata3 will be removed in a future release. Use TriScatteredInterp instead.

Syntax

w = griddata3(x,y,z,v,xi,yi,zi)
w = griddata3(x,y,z,v,xi,yi,zi,method)

Description

w = griddata3(x,y,z,v,xi,yi,zi) fits a hypersurface of the form to the data in the (usually) nonuniformly spaced vectors (x, y, z, v). griddata3 interpolates this hypersurface at the points specified by (xi,yi,zi) to produce w. w is the same size as xi, yi, and zi.

(xi,yi,zi) is usually a uniform grid (as produced by meshgrid) and is where griddata3 gets its name.

w = griddata3(x,y,z,v,xi,yi,zi,method) defines the type of surface that is fit to the data, where method is either:

'linear'

Tesselation-based linear interpolation (default)

'nearest'

Nearest neighbor interpolation

If method is [], the default 'linear' method is used.

w = griddata3(...,options) specifies a cell array of strings options that were previously in Qhull. Qhull-specific options are no longer required and are currently ignored.

griddata3 uses CGAL, see http://www.cgal.org.

Examples

Create vectors x, y, and z containing nonuniformly sampled data:

x = gallery('uniformdata',[5000 1],0)-1;
y = gallery('uniformdata',[5000 1],1)-1;
z = gallery('uniformdata',[5000 1],2)-1;
v = x.^2 + y.^2 + z.^2;

Define a regular grid, and grid the data to it:

d = -0.8:0.05:0.8;
[xi,yi,zi] = meshgrid(d,d,d);
w = griddata3(x,y,z,v,xi,yi,zi);

Since it is difficult to visualize 4-D data sets, use isosurface at 0.8:

p = patch(isosurface(xi,yi,zi,w,0.8));
isonormals(xi,yi,zi,w,p);
set(p,'FaceColor','blue','EdgeColor','none');
view(3), axis equal, axis off, camlight, lighting phong 

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS