?? xinterp1.m
字號:
% xInterp1.m
% 一維插值例子
% 本程序演示函數interp1()的用法
%
% Author: HUANG Huajiang
% Copyright 2003 UNILAB Research Center,
% East China University of Science and Technology, Shanghai, PRC
% $Revision: 1.0 $ $Date: 2003/02/23 $
clear all
clc
% 已知離散點(x,y)
x = [2.5 2.6 2.7 2.8 2.9];
y = exp(x);
xi = [2.55 2.63 2.77 2.86]; % 插值向量
% 一維插值
yi_interp1_nearst = interp1(x,y,xi,'nearst') % 最近插值
yi_interp1_linear = interp1(x,y,xi) % 線性插值(默認)
yi_interp1_spline = interp1(x,y,xi,'spline') % 三次樣條插值
yi_interp1_pchip = interp1(x,y,xi,'pchip') % 分段三次Hermite插值
y_true = exp(xi) % 對應于插值向量的真實函數值
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -