资源简介
matlab读取txt一系列离散点,然后利用scatter3,mesh拟合出三维模型
代码片段和文件信息
function fit(result)
x=result(:1);
y=result(:2);
z=result(:3);
%set(gca‘XTick‘[01001000]‘YTick‘[01001000]);
set(gca‘ZTick‘[0530]);
%zlim([0 90])
scatter3(xyz5)
%plot3(xyz-1100);
%surf(xyz)
figure
%linspace :起始值,终止值,个数
xlin = linspace(min(x)max(x));
ylin = linspace(min(y)max(y));
[XY]=meshgrid(xlinylin);
Z = griddata(xyzXY‘cubic‘); %cubic :效果不错,但是每个点下面有条线
Z2 = griddata(xyzXY‘nearest‘); %nearest 最近邻居插补法
Z3 = griddata(xyzXY‘linear‘); %linear 三角形的线性插补法
%Z = griddata(xy
评论
共有 条评论