⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newton_interpol.m

📁 程序包中含有Lagrange插值、Newton插值、Hermite插值、jacobi迭代、gauss迭代、 超松弛迭代、cholesky分解
💻 M
字号:
% Interpolation with Newton  polynomials

% Input: x,y: y=f(x)
%            xt: where interpolant is evaluated.
% Output: yt=f(xt)

function yt =  Newton_interpol(x,y,xt)

n = length(y); if length(x)~=n, error('x and y are not compatible'); end

c=y(:);
for j=2:n
    for i=n:-1:j
        c(i)=( c(i)-c(i-1) )  /  ( x(i) - x(i-j+1) );  % note that x(i)-x(i-1) is not right.
    end
end

% Nested evaluation of the polynomial
yt = c(n);
for i= n-1 :-1 :1
    yt = yt.*(xt - x(i)) + c(i);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -