Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- x=[45 50 55 60 65]
- y=f(x)=[29 24 21 19 17]
- x estimate = 46
- Ans:
- 27.996288
- */
- function[] = newton_bkwd(x,y,xest)
- n=length(y)
- h=x(2)-x(1)
- p=(xest-x(n))/h
- for i=1:n-1
- d(i+1,1)=y(i+1)-y(i)
- end
- for j=2:n
- for i=2:n
- d(i,j)=d(i,j-1)-d(i-1,j-1)
- end
- end
- e(1)=p
- for j=2:n
- e(j)=e(j-1)*(p-1+j)/j
- end
- yest=0;
- for j=1:n
- yest=yest+e(j)*d(n,j)
- end
- yest=yest+y(n)
- disp(yest)
- endfunction
- x=[45 50 55 60 65]
- y=[29 24 21 19 17]
- xest=46
- newton_bkwd(x,y,xest)
Add Comment
Please, Sign In to add comment