l1.m
来自「fit programme for a serials of data」· M 代码 · 共 18 行
M
18 行
function X=L1(x,y,x1)
% input x is a vector that contains a list of abscissas
% y is a vector that cntains a list of ordinates
% x1 is the number at where the interpolation is to be obained
% output X is the linear interpolation at x1
n=length(x);
j=-1;
for i=1:n-1
if x1<x(i+1)&&x1>x(i)
j=i;
break;
end
end
if j==-1
'false';
return;
end
X=y(j)*(x1-x(i+1))/(x(i)-x(i+1))+y(i+1)*(x1-x(i))/(x(i+1)-x(i));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?