Untitled
clc f=@(x) x*x-3 f=input("Enter the equation:"); a=1; b=2; torareble error =0.0001 if f(a)*f(b)<0 for i= :100 c= a*f(b)-b*f(a)/f(b)-f(a) fprintf("root= %d",c); if abs (f(c-b))< 0 break; end if f(a)*f(c),0 b=c; end b=c; end end end
Leave a Comment