matlab里用对分法求超越方程lnx=cos(x+t),其中t取pi/8,详细的贴出来代码,

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 22:46:43
matlab里用对分法求超越方程lnx=cos(x+t),其中t取pi/8,详细的贴出来代码,

matlab里用对分法求超越方程lnx=cos(x+t),其中t取pi/8,详细的贴出来代码,
matlab里用对分法求超越方程lnx=cos(x+t),其中t取pi/8,详细的贴出来代码,

matlab里用对分法求超越方程lnx=cos(x+t),其中t取pi/8,详细的贴出来代码,
先画个图像,确定根的范围在[0,2]
clc
clear
a=0;
b=2;
f=@(x) log(x)-cos(x+pi/8);
Tol=1e-12;
while (b-a)>Tol
c=(a+b)/2;
if f(c)>0
b=c;
elseif f(c)