0% found this document useful (0 votes)
6 views1 page

Bisection Method for Root Finding

The document describes the implementation of the Bisection Method to find the root of the function f(x) = -0.6*x^2 + 2.4*x + 5.5 within the interval [5, 10]. It outlines the iterative process, including calculations of approximate relative error and updates to the lower and upper bounds. The results of each iteration are displayed in a table format, showing the progress towards the root.

Uploaded by

Taveed Ghazarian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Bisection Method for Root Finding

The document describes the implementation of the Bisection Method to find the root of the function f(x) = -0.6*x^2 + 2.4*x + 5.5 within the interval [5, 10]. It outlines the iterative process, including calculations of approximate relative error and updates to the lower and upper bounds. The results of each iteration are displayed in a table format, showing the progress towards the root.

Uploaded by

Taveed Ghazarian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

% Bisection Method

clc,clear
f=@(x) -0.6*x^2+2.4*x+5.5;
xl=5; xu=10; % lower and upper values
ezplot(f,[xl,xu]); % Graph of function
ea=100; % Approximate percent relative error
es=11; % Prespecified percent tolerance
c=1; % Count of steps( Number of iterations)
xrp=0; % xrp-previous

while ea > es
xr=(xl+xu)/2;

ea=abs((xr-xrp)/xr)*100;
Result(c,:)=[ c , xl ,xu , xr , f(xl), f(xu), f(xr), ea ];

if f(xl)*f(xr)<0
xu=xr;
elseif f(xl)*f(xr)>0
xl=xr;
else
disp(['The root xr=' xr])
break;
end

c=c+1;
xrp=xr; % To change xrp-previous with xr-present
end
Result

--------------------------------------------------------------

>>

Result =

𝒄 𝒙𝐥 𝒙𝐮 𝒙𝐫 𝒇(𝒙𝐥 ) 𝒇(𝒙𝐮 ) 𝒇(𝒙𝐫 ) 𝜺𝒂


1.0000 5.0000 10.0000 7.5000 2.5000 -30.5000 -10.2500 100.0000

2.0000 5.0000 7.5000 6.2500 2.5000 -10.2500 -2.9375 20.0000

3.0000 5.0000 6.2500 5.6250 2.5000 -2.9375 0.0156 11.1111

4.0000 5.6250 6.2500 5.9375 0.0156 -2.9375 -1.4023 5.2632

Bewar Y. Ali Numerical Analysis

You might also like