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

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/02 23:35:48

急需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程序
x的是3次方,要求e

急需MATLAB二分法求方程求求方程f(x)=x^3-sin(x)-12*x+1的全部实根,ε=10^-6程序x的是3次方,要求e
在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)