Newton Divided Difference Method
3 views (last 30 days)
Show older comments
I'm writing a code for interpolation using Newton's method. The code works but it gave me a different value. When I enter f(x) = log(x), x0=1, it gave me y=1 which is wrong. Can anyone help me?
syms x
d = input('enter f(x)= \n')
f=inline(d);
z=diff(f(x));
f1=inline(z);
x0=input('inter x0 = \n')
x=x0
for u=0:inf
y=x
x=y-(f(x)/f1(x));
if x==y
break
end
end
enter f(x)=
log(x)
d =
log(x)
inter x0 =
1
x0 =
1
x =
1
Warning: FOR loop index is too large. Truncating to 9223372036854775807.
y =
1
>>
0 Comments
Answers (1)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!