| Contents | Index |
Note Qhull-specific options are no longer supported. Remove the OPTIONS argument from all instances in your code that pass it to griddata. In a future release, the following syntaxes will be removed: [Xq,Yq,Vq] = griddata(x,y,v,xq,yq) [Xq,Yq,Vq] = griddata(x,y,v,xq,yq, method) In addition, griddata will not accept any input vectors of mixed orientation in a future release. To specify a grid of query points, construct a full grid with ndgrid or meshgrid before calling griddata. |
vq = griddata(x,y,v,xq,yq)
vq = griddata(x,y,z,v,xq,yq,zq)
vq = griddata(..., method)
vq = griddata(x,y,v,xq,yq) fits a surface of the form v = f(x,y) to the scattered data in the vectors (x,y,v). The griddata function interpolates the surface at the query points specified by (xq,yq) and returns the interpolated values, vq. The surface always passes through the data points defined by x and y.
vq = griddata(x,y,z,v,xq,yq,zq) fits a hypersurface of the form v = f(x,y,z).
vq = griddata(..., method) uses a specified interpolation method to compute vq.
vq |
The interpolated values at the query points.
|
Sample a function at 100 random points between -2.0 and 2.0.
rng(0,'twister')
x = rand(100,1)*4-2;
y = rand(100,1)*4-2;
z = x.*exp(-x.^2-y.^2);x, y, and z are now vectors containing nonuniformly sampled data. Define a regular grid and interpolate the scattered data over the grid.
ti = -2:.25:2; [xq,yq] = meshgrid(ti,ti); zq = griddata(x,y,z,xq,yq);
Plot the gridded data along with the scattered data.
mesh(xq,yq,zq), hold plot3(x,y,z,'o'), hold off set(gca,'XTick',[-2 -1 0 1 2]); set(gca,'YTick',[-2 -1 0 1 2]);

Sample a function at 5000 random points between -1 and 1.
rng(0,'twister') x = 2*rand(5000,1)-1; y = 2*rand(5000,1)-1; z = 2*rand(5000,1)-1; v = x.^2 + y.^2 + z.^2;
x, y, and z are now vectors containing nonuniformly sampled data. Define a regular grid with points in the range [-0.8, 0.8].
d = -0.8:0.05:0.8; [xq,yq,zq] = meshgrid(d,d,0);
Interpolate the scattered data over a rectangular region at z=0. Then, plot the results.
vq = griddata(x,y,z,v,xq,yq,zq); surf(xq,yq,vq); set(gca,'XTick',[-1 -0.5 0 0.5 1]); set(gca,'YTick',[-1 -0.5 0 0.5 1]);

delaunay | griddatan | interpn | meshgrid | ndgrid | TriScatteredInterp

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |