📄 neicha.m
字号:
clear all;
clc;
data=[
0 498
0.1 490
0.2 486
0.3 480
0.4 473
0.5 456
0.6 452
0.7 445
0.8 433
0.9 417
% 0.0 49.50
% 0.1 55.24
% 0.2 58.46
% 0.3 68.89
% 0.4 84.76
% 0.5 105.7
% 0.6 108.4
% 0.7 125.4
% 0.8 140.8
% 0.9 175.4
];
x=data(:,1);
y=data(:,2);
xi=0:0.01:0.9;
y1=interp1(x,y,xi,'nearest');
y2=interp1(x,y,xi,'linear');
y3=interp1(x,y,xi,'spline');
y4=interp1(x,y,xi,'cubic');
figure
% subplot(2,2,1)(x,y,'o');
subplot(2,2,1),plot(xi,y1,'r');axis([0 0.9 410 500]);grid on;title('临近点内插法');
subplot(2,2,2),plot(xi,y2,'g');axis([0 0.9 410 500]);grid on;title('线性内插法');
subplot(2,2,3),plot(xi,y3,'b');axis([0 0.9 410 500]);grid on;title('三次样条内插法');
subplot(2,2,4),plot(xi,y4,'m');axis([0 0.9 410 500]);grid on;title('三次多项式内插法');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -