【发布时间】:2010-09-06 09:43:25
【问题描述】:
我发现如果我使用griddata方法和Cubic插值方法,对于x,y的某些值,它会返回NaN。 One post 表示这是因为 x 和 y 数据非常接近凸包。
知道如何解决这个问题吗?
编辑:请注意,我无法确保我的输入单调增加(因此,gridfit 不起作用)。原因是我必须对我的区域进行网格化(这可能是 2D 中的不规则多边形),在为每个点生成对应的 Z 值之前获取所有点。我的代码如下:
function ZI=Interpolate3D(scatteredData, boundary)
%scatteredData is the scattered points, boundary is the area that I want to generate 3D surface.
% Given the boundaries, generate mesh first
[element,points]= GenMesh(boundary);
ZI = griddata(scatteredData(:,1),scatteredData(:,2),scatteredData(:,3),points(:,1),points(:,2), 'cubic',{'QJ'});
【问题讨论】:
标签: matlab