> 其他 >
请问怎么用matlab编程,使用牛顿迭代法求根号5的立方的近似值?
人气:265 ℃ 时间:2020-05-24 17:50:43
解答
1.创建一个函数%牛顿法求立方根function x=cube_newton(a)f=@(x)x^3-a;df=diff(sym('x^3-a'));if a==0;x1=a;elsex0=a;x1=x0-f(x0)/subs(df,x0);while abs(x1-x0)>1e-6x0=x1;x1=x0-f(x0)/subs(df,x0);endendx=x1;2.>>...
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版