newtintpoleval.m
来自「Interpolation routines in matlab」· M 代码 · 共 37 行
M
37 行
%% Evaluate Newton's interpolating polynomial at% given points.%% function [p] = NewtIntPolEval( x, a, z )%% input:% x: vector containing the % interpolation points% a: vector of coefficients of Newton's % interpolating polynomial% z: vector of points at which Newton's % interpolating polynomial has to be% evaluated%% output:% p: vector of values of Newton's % interpolating polynomial%%function [p] = NewtIntPolEval( x, a, z );n = size(x(:),1);if size(a(:),1) ~= n error(' NewtIntPolEval: Dimension of a must be equal to dimension of x')endp = a(n) * ones(size(z));for i = n-1:-1:1 p = p .* ( z - x(i) * ones(size(z)) ) + a(i);end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?