📄 chazhi.m
字号:
h=1:12;
temp=[5 8 9 15 25 29 31 30 22 25 27 24]; % 这组温度数据变化较大
plot(h,temp,'--',h,temp,'+') % 将线性内插结果绘图
disp('press any key to continue--')
pause
h_3=1:0.1:12; % 要每0.1小时估计一次温度值
t_3=interp1(h,temp,h_3,'cubic'); % 以三次方程式做内插
t_s=interp1(h,temp,h_3,'spline'); % 以spline函数做内插
hold on
subplot(1,2,1)
plot(h,temp,'--',h,temp,'+',h_3,t_3) % 将线性及三次方程式内插绘图
title('线性及三次方程式内插绘图')
subplot(1,2,2)
plot(h,temp,'--',h,temp,'+',h_3,t_s) % 将线性方程式及spline内插绘图
title('线性方程式及spline内插绘图')
hold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -