function erfenfa
clc,clear all
a=-1;b=sqrt(2);
epsilon=1e-05;
if fun(a)*fun(b)<=0
disp('方程的解是: ')
x0=(a+b)/2;
while abs(fun(x0))>=epsilon
c=(a+b)/2;
if fun(a)*fun(c)<=0
b=c;
else
a=c;
end
x0=(a+b)/2;
end
else
disp('方程无解')
end
x0
function y=fun(x)
y=x-sin(x)