function bp=backward_interpolation(x,y,p)
n=length(x);
for i=1:n
diff(i,1)=y(i);
end
for j=2:n
for i=n:-1:j
diff(i,j)=diff(i,j-1)-diff(i-1,j-1);
end
end
answer=y(n);
h=x(n)-x(n-1);
s=(p-x(n))/h;
for i=1:n-1
term=1;
for j=1:i
term=term*(s+j-1)/j;
end
answer=answer+term*diff(n,i+1);
end
bp=answer;
Arguments sent to the function are:- lagrange(xdataset,ydataset,interpolating point)
0 comments:
Post a Comment