6
.
.......................................................................................................................................................17
【一
维
插
值
】
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');