__________________________________________________
山区地貌问题:在某山区测得一些地点的高程如下表。(平面区域为:
1200<=x<=4000,1200<=y<=3600)。试作出该山区的地貌图和等高线图,并对几种插值方法进行比较。
解:x0=1200:400:4000;
y0=1200:400:3600;
z0=[1130,1250,1280,1230,1040,900,500,700;
1320,1450,1420,1400,1300,700,900,850; 1390,1500,1500,1400,900,1100,1060,950; 1500,1200,1100,1350,1450,1200,1150,1010; 1500,1200,1100,1550,1600,1550,1380,1070; 1500,1550,1600,1550,1600,1600,1600,1550; 1480,1500,1550,1510,1430,1300,1200,980];
meshc(x0,y0,z0) xlabel('x'); ylabel('y'); zlabel('z') title('原始图')
__________________________________________________
__________________________________________________
原始图160014001200z10008006004004000300030002000y100010002000x4000
原始图160014001200z10008006004004000300030002000y100010002000x4000
(1) 分段线性插值
输入命令:
[xi2,yi2]=meshgrid(1200:10:4000,1200:10:3600); zi2=interp2(x0,y0,z0,xi2,yi2,'linear'); meshc(xi2,yi2,zi2)
__________________________________________________
__________________________________________________
xlabel('x');
ylabel('y'); zlabel('z')
title('插值后')
(2) 三次样条插值
输入命令:
[xi,yi]=meshgrid(1200:10:4000,1200:10:3600);
zi=interp2(x0,y0,z0,xi,yi,'spline'); meshc(xi,yi,zi),
title('三次样条插值表面图')
xlabel('x');ylabel('y');zlabel('z')
__________________________________________________
山区地貌问题
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)