?? 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 + -