function
[c,err,yc]=bisection(f,a,b,err_tolerance)
ya=feval(f,a);
yb=feval(f,b);
if
ya*yb >
0,return,end
maxx=1+round((log(b-a)-log(err_tolerance))/log(2));
for
k=1:maxx
c=(a+b)/2;
yc=feval(f,c);
if yc==0
a=c;
b=c;
elseif
yb*yc>0
b=c;
yb=yc;
else
a=c;
ya=yc;
end
if b-a <
err_tolerance, break,end
end
c=(a+b)/2;
err=abs(b-a);
yc=feval(f,c);
Comments
but y it appear those error comment? ??? Error: File: Untitled.m Line: 6 Column: 1 Function definitions are not permitted in this context.... tis error come out by the "function" word...
Leave a comment