Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [x,ile]=bissect(fun, a,b,epsilon)
- f=fcnchk(fun);
- i=0;
- while 1
- i=i+1;
- p=(a+b)/2;
- if f(a)*f(p)<0
- b=p;
- else
- a=p;
- end
- if abs(f(p))<epsilon
- x=p;
- ile=i;
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement