MATLAB拉格朗日插值法程序
拉格朗日插值法程序 n=size(pointx,2); L=ones(n,size(x,2)); if (size(pointx,2)~=size(pointy,2)) fprintf(1,'\nERROR!\nPOINTX and POINTY must have the same number of elements\n'); y=NaN; else for i=1:n for j=1:n if (i~=j) L(i,:)=L(i,:).*(x-pointx(j))/(pointx(i)-pointx(j)); end end end y=0; for i=1:n y=y+pointy(i)*L(i,:); end end
文件列表
lagrange.zip
(预估有个1文件)
lagrange.m
908B
用户评论