Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [wyn] = bisekcjav2(g,a,b)
- epsil = 0.001;
- f = @(x)eval(g);
- c = (a+b)/2;
- if(f(a)*f(b) > 0)
- disp('Funkcja nie spelnia zalozen')
- wyn = NaN;
- return
- end
- while(abs(f(c))>epsil)
- c = (a + b)/2;
- if(f(a)*f(c)<0)
- b = c;
- else
- a = c;
- end
- end
- wyn = c;
- end
- %bisekcjav2('x^3+x^2-1',0,2)
Advertisement
Add Comment
Please, Sign In to add comment