Matlab三维拟合函数griddata
2012-04-10 10:31
176 查看
griddata Data gridding SyntaxZI = griddata(x,y,z,XI,YI)
[XI,YI,ZI] = griddata(x,y,z,XI,YI)
[...] = griddata(...,method)
[...] = griddata(...,method,options)
DescriptionZI = griddata(x,y,z,XI,YI) fits a surface of the form z = f(x,y) to the data in the (usually) nonuniformly spaced vectors (x,y,z). griddata interpolates this surface at the points specified by (XI,YI) to produce ZI. The surface always passes through
the data points. XI and YI usually form a uniform grid (as produced by meshgrid). XI can be a row vector, in which case it specifies a matrix with constant columns. Similarly, YI can be a column vector, and it specifies a matrix with constant rows. [XI,YI,ZI]
= griddata(x,y,z,XI,YI) returns the interpolated matrix ZI as above, and also returns the matrices XI and YI formed from row vector XI and column vector yi. These latter are the same as the matrices returned by meshgrid. [...] = griddata(...,method) uses the
specified interpolation method: 'linear' Triangle-based linear interpolation (default)'cubic'Triangle-based cubic interpolation'nearest'Nearest neighbor interpolation'v4'MATLAB 4 griddata methodThe method defines the type of surface fit to the data. The 'cubic'
and 'v4' methods produce smooth surfaces while 'linear' and 'nearest' have discontinuities in the first and zero'th derivatives, respectively. All the methods except 'v4' are based on a Delaunay triangulation of the data. If method is [], then the default
'linear' method is used. [...] = griddata(...,method,options) specifies a cell array of strings options to be used in Qhull via delaunayn. If options is [], the default delaunayn options are used. If options is {''}, no options are used, not even the default.
Occasionally, griddata might return points on or very near the convex hull of the data as NaNs. This is because roundoff in the computations sometimes makes it difficult to determine if a point near the boundary is in the convex hull. RemarksXI and YI can
be matrices, in which case griddata returns the values for the corresponding points (XI(i,j),YI(i,j)). Alternatively, you can pass in the row and column vectors xi and yi, respectively. In this case, griddata interprets these vectors as if they were matrices
produced by the command meshgrid(xi,yi). AlgorithmThe griddata(...,'v4') command uses the method documented in [3]. The other griddata methods are based on a Delaunay triangulation of the data that uses Qhull [2]. For information about Qhull, see http://www.qhull.org/. For copyright information, see http://www.qhull.org/COPYING.html. ExamplesSample a function at 100 random points between ±2.0: rand('seed',0)
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 grid the data to it: ti = -2:.25:2;
[XI,YI] = meshgrid(ti,ti);
ZI = griddata(x,y,z,XI,YI);
Plot the gridded data along with the nonuniform data points used to generate it: mesh(XI,YI,ZI), hold
plot3(x,y,z,'o'), hold off
[XI,YI,ZI] = griddata(x,y,z,XI,YI)
[...] = griddata(...,method)
[...] = griddata(...,method,options)
DescriptionZI = griddata(x,y,z,XI,YI) fits a surface of the form z = f(x,y) to the data in the (usually) nonuniformly spaced vectors (x,y,z). griddata interpolates this surface at the points specified by (XI,YI) to produce ZI. The surface always passes through
the data points. XI and YI usually form a uniform grid (as produced by meshgrid). XI can be a row vector, in which case it specifies a matrix with constant columns. Similarly, YI can be a column vector, and it specifies a matrix with constant rows. [XI,YI,ZI]
= griddata(x,y,z,XI,YI) returns the interpolated matrix ZI as above, and also returns the matrices XI and YI formed from row vector XI and column vector yi. These latter are the same as the matrices returned by meshgrid. [...] = griddata(...,method) uses the
specified interpolation method: 'linear' Triangle-based linear interpolation (default)'cubic'Triangle-based cubic interpolation'nearest'Nearest neighbor interpolation'v4'MATLAB 4 griddata methodThe method defines the type of surface fit to the data. The 'cubic'
and 'v4' methods produce smooth surfaces while 'linear' and 'nearest' have discontinuities in the first and zero'th derivatives, respectively. All the methods except 'v4' are based on a Delaunay triangulation of the data. If method is [], then the default
'linear' method is used. [...] = griddata(...,method,options) specifies a cell array of strings options to be used in Qhull via delaunayn. If options is [], the default delaunayn options are used. If options is {''}, no options are used, not even the default.
Occasionally, griddata might return points on or very near the convex hull of the data as NaNs. This is because roundoff in the computations sometimes makes it difficult to determine if a point near the boundary is in the convex hull. RemarksXI and YI can
be matrices, in which case griddata returns the values for the corresponding points (XI(i,j),YI(i,j)). Alternatively, you can pass in the row and column vectors xi and yi, respectively. In this case, griddata interprets these vectors as if they were matrices
produced by the command meshgrid(xi,yi). AlgorithmThe griddata(...,'v4') command uses the method documented in [3]. The other griddata methods are based on a Delaunay triangulation of the data that uses Qhull [2]. For information about Qhull, see http://www.qhull.org/. For copyright information, see http://www.qhull.org/COPYING.html. ExamplesSample a function at 100 random points between ±2.0: rand('seed',0)
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 grid the data to it: ti = -2:.25:2;
[XI,YI] = meshgrid(ti,ti);
ZI = griddata(x,y,z,XI,YI);
Plot the gridded data along with the nonuniform data points used to generate it: mesh(XI,YI,ZI), hold
plot3(x,y,z,'o'), hold off
相关文章推荐
- matlab 函数拟合polyfit
- 数据拟合---使用自定义函数进行非线性拟合 -在Origin。matlab拟合工具箱cftool
- 使用matlab函数构建三维立方体的几种方法
- matlab曲线拟合 函数 用法以及例子
- 【matlab】用matlab的线性回归和线性拟合求出两者的关系函数
- matlab拟合三维椭球
- 数据可视化(Matlab)丨绘制绘制二维、三维和四维图形以及图形编辑与函数图形的绘制
- matlab中三维图形绘制函数
- Matlab物化实验——已知函数表达式用最小二乘法拟合
- MATLAB拟合函数使用说明
- 关于matlab中数据拟合的一些函数polyfit()
- 数据拟合---使用自定义函数进行非线性拟合 -在Origin。matlab拟合工具箱cftool
- matlab之griddata函数
- MATLAB利用散点进行函数曲线拟合
- [Matlab绘图][三维图形][三维曲线基本函数+三维曲面+其他三维图形]
- Matlab一个利用神经网络拟合函数的例子
- Matlab的曲线拟合工具箱CFtool使用简介及一种非线性函数的曲线拟合方法(函数公式: k = A*(T^a)*exp(E/T) )
- MATLAB 自定义函数拟合
- matlab函数公式拟合