na-lab-newtondivided differences

Version 1.0.0 (1.17 KB) by Akshay
code
1 Download
Updated 15 Nov 2022

View License

clc;
x=input("enter x");
y=input("enter y");
n=length(x);
f=zeros(n,n);
f(:,1)=y;
p=input("enter point");
for i=2:n
for j=i:n
f(j,i)=(f(j,i-1)-f(j-1,i-1))/(x(j)-x(j-i+1));
end
end
for i=1:n
prod(i)=1;
for j=1:i-1
prod(i)=prod(i)*(p-x(j));
end
end
sum=0;
for i=1:n
sum=sum+(f(i,i)*prod(i));
end
disp(sum);

Cite As

Akshay (2024). na-lab-newtondivided differences (https://www.mathworks.com/matlabcentral/fileexchange/120523-na-lab-newtondivided-differences), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0