Determine the real root of f ( x )=−12−21 x+18 x
2−2.75 x
3
. Using bisection to locate the
root. Employ initial guesses of xL=−1 and xU=0 and iterate until the estimated error falls
below a level of 1%.
Answers
Answered by
0
Answer:
clc
f = @(x) -12-(21*x)+(18*x^2)-(2.75*x^3);
a=-1;
b=0;
p=a;
%Bisection Method
while (abs(f(p))>0.01)
p = (a+b)/2;
if f(p) == 0
break;
end
if f(a)*f(p)<0
b=p;
else
a = p;
end
end
fprintf('The final root through bisection method is %f\n',p);
%False Position Method
p=a;
while (abs(f(p))>0.01)
p = (a*f(b)-b*f(a))/(f(b)-f(a));
if f(p) == 0
break;
end
if f(a)*f(p)<0
b=p;
else
a = p;
end
end
fprintf('The final root through False Position method is %f\n',p);
Similar questions