function s = solve_equation (f, a, b, e)
while abs ( subs(f, a) * subs(f, b) ) > 2*e
half = ( a+b )/2 ;
if ( subs(f,a) * subs(f, half) ) <= 0
b = half ;
else
a = half ;
end
end
s = a;
No comments:
Post a Comment