Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function x = regulaFalsi(a, b, n)
- c = f(a);
- d = f(b);
- if c * d > 0
- error('The function has same sign on both the sides')
- end
- for i = 1 : n
- if f(a) == f(b)
- break;
- end
- x = (a * f(b) - b * f(a)) / (f(b) - f(a));
- if f(x) < 0
- a = x;
- elseif f(x) > 0
- b = x;
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement