作业帮 > 综合 > 作业

急需MATLAB二分法求方程求求方程f(x)=x^3-sin(x)-12*x+1的全部实根,ε=10^-6程序

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/12 07:32:50
急需MATLAB二分法求方程求求方程f(x)=x^3-sin(x)-12*x+1的全部实根,ε=10^-6程序
x的是3次方,要求e
急需MATLAB二分法求方程求求方程f(x)=x^3-sin(x)-12*x+1的全部实根,ε=10^-6程序
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y=zhidao_fx(x)
y=x.^3-sin(x)-12*x+1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function x=findroot2(fx,x0,x1)
e=1e-6;
y0=eval([fx,'(x0)']);
y1=eval([fx,'(x1)']);
x=(x0+x1)/2;
y=eval([fx,'(x)']);
if (abs(x0-x1)