Professional Documents
Culture Documents
3.75;
5;
= 20;
0.5;
0; % Dummy value for xr.
Fl=F(xl);
Fu=F(xu);
if Fl*Fu > 0
% False Position
Equation
Fr=F(xr);
ea=abs((xr-xrold)/xr)*100;
% Error calculation
if Fr == 0
fprintf('An exact solution x =%11.6f was
found',xr)
end
break
if ea < es
break
end
if i == imax
fprintf('Solution was not obtained in %i
iterations',imax)
break
end
if Fl*Fr
xu =
else
xl =
Fl =
end
< 0
xr;
xr;
Fr;
end
fprintf('The approximate solution is x = %8.4f \n ',xr)
end
ANSWER
------------------------------------------------------------i
xl
xu
xr
Fr
ea
------------------------------------------------------------1
3.7500
5.0000
3.9248
-2.1942
100.0000
2
3.9248
5.0000
3.9782
-0.6493
1.3419
3
3.9782
5.0000
3.9937
-0.1874
0.3895
The approximate solution is x =
3.9937