F =inline('x^3-2*x-3');a=1; b=2; nmax=20;Fa=F(a); Fb=F(b);if Fa*Fb<0 wn=(a*F(b) - b*F(a))/(F(b)-F(a)); c = Fa; g = Fb; wo = a; while(1) wn=(a*g - b*c)/(g-c); if c*F(wn)<0 b=wn; g=F(wn); if F(wo)*F(wn)>0 c=c/2; end else a=wn; F=F(wn); if F(wo)*F(wn)>0 g=g/2; end end % if abs((wn-wo)/wn)<(.5*10^(-n))
%break
%end
endend
MATLAB: I am unable to get the result due to error, and dont know how to fix it. please reply
modified regula falsi method
Best Answer