Newton Divided Difference Method
显示 更早的评论
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
>>
回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!