Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2010-12-08
帖子: 2
声望力: 0 ![]() |
![]()
f(x)=ln((513+0.6651*x)/(513-0.6651*x))-x/(1400*0.0918)
求解该方程的非零近似解,选择牛顿法即x1=x0-f(x0)/f'(x0) 首先建立fun函数的m文件: function [f1,f2]=fun(x) f1=log((513+0.6651*x)/(513-0.6651*x))-x/(1400*0.0918); f2=-(((0.6651*(0.6651*x+513))/(0.6651*x-513)^2-0.6651/(0.6651*x-513))*(0.6651*x-513))/(0.6651*x+513)-0.0077808901338313103018985371926548; 然后用牛顿迭代公式编写算法: m=1.0e-10; N=20; n=1; x1=10; [f1,f2]=fun(x1); x=x1-f1/f2; while abs(x-x1)>m if n<N n=n+1; x1=x; [f1,f2]=fun(x1); x=x1-f1/f2; else disp('失败!') break end end 得到x = -1.4006e-015 这是非零解么? |
![]() |
![]() |