invdiff.m
来自「Mathematical Methods by Moor n Stiling.」· M 代码 · 共 26 行
M
26 行
function phis = invdiff(ts,fs)
%
% Compute the inverse differences for a rational interpolation function,
% returning the vector of inverse differences that are necessary for
% interpolation
%
% function phis = invdiff(ts,fs)
%
% ts = vector of independent variable
% fs = vector of dependent variable
%
% phis = inverse differences
% Copyright 1999 by Todd K. Moon
n = length(ts);
phis = fs;
for i=1:n-1
for j=i+1:n
if(phis(i)==phis(j))
fprintf(1,'denom zero: i=%d j=%d num=%f\n',i,j,ts(i)-ts(j));
else
phis(j) = (ts(i) - ts(j))/(phis(i) - phis(j));
end
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?