目录
【一维插值】interp1 (1)
yi = interp1(x,y,xi,method) (1)
例1 (1)
例2 (2)
【二维插值】interp2 (4)
ZI = interp2(X,Y,Z,XI,YI,method) (4)
插值方式比较示例 (4)
例3 (8)
例4 (9)
【三角测量和分散数据插值】 (13)
【数据拟合】 (17)
例5 (17)
例6 (18)
【一维插值】interp1
yi = interp1(x,y,xi,method)
例1
在1-12的11小时内,每隔1小时测量一次温度,测得的温度依次为:5,8,9,15,25,29,31,30,22,25,27,24。试估计每隔1/10小时的温度值。
建立M文件temp.m
hours=1:12;
temps=[5 8 9 15 25 29 31 30 22 25 27 24];
h=1:0.1:12;
t=interp1(hours,temps,h,'spline');
plot(hours,temps,'kp',h,t,'b');