magicsun 发表于 2015-7-3 19:38 
我的意思是你怎么解,不是函数。
我用的是二分法~~~
function y=erfen(fun,a,b,esp)
if nargin<4
esp=1e-4;
end
if feval(fun,a)*feval(fun,b)<0
n=1;
c=(a+b)/2;
while c>esp
if feval(fun,a)*feval(fun,c)<0
b=c;
c=(a+b)/2;
elseif feval(fun,c)*feval(fun,b)<0
a=c;
c=(a+b)/2;
else
y=c;
esp=10000;
end
n=n+1;
end
y=c;
elseif feval(fun,a)==0
y=a;
elseif feval(fun,b)==0
y=b;
else disp('these,may not be a root in the intercal');
end
n