文件名称:MATLAB拉格朗日插值法程序
文件大小:561B
文件格式:ZIP
更新时间:2013-10-14 04:31:18
拉格朗日
拉格朗日插值法程序 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.m