怎样能更好的编写拉格朗日差值多项式程序
谢谢 Lagrange 插值多项式功能:求基于N+1个点的拉格朗日多项式
function =lagran(X,Y)
% input - X is a vector that contains a list of abscissas
% - Y is a vector that contains a list of ordinates
% output- C is a matrix that contains the coefficients of the lagrange interpolatory polynomial
- L is a matrix that contains the lagrange coefficientspolynomial
w=length(X);
n=w-1;
L=zeros(w,w);
for k=1:n+1
V=1;
for j=1:n+1
if k~=j
V=conv(V,poly(X(j)))/(X(k)-X(j));
end
end
L(k,:)=V;
end
C=Y*L;
页:
[1]