Halcom 发表于 2019-10-16 22:49:50

三维曲面插值


三维曲面插值:
clc,clear,close all
= meshgrid(-4:4);                           %产生已知数据栅格点
z = peaks(x,y);                                 %计算已知点上的函数值
= meshgrid(-4:0.25:4);                %产生更精细的插值栅格点
z1 = interp2(x,y,z,x1,y1,'nearest');
subplot(131),surf(x1,y1,z1)                %画基于最邻近法插值的三维表面图
xlabel('最邻近法插值')
z2 = interp2(x,y,z,x1,y1,'linear');
subplot(132),surf(x1,y1,z2)                  %画基于二维分段线性插值的三维表面图
xlabel('分段线性插值')
z3 = interp2(x,y,z,x1,y1,'cubic');
subplot(133),surf(x1,y1,z3)                  %画基于二维三次多项式插值的三维表面图
xlabel('三次多项式插值')

页: [1]
查看完整版本: 三维曲面插值