Bisection Method Using Matlab Software
Bisection Method Using Matlab Software
EXPERIMENT # 2
BISECTION METHOD
Submitted by:
ALETA, ZEFFREY JON M.
Submitted to:
ENGR. SIMON KENNETH E. SANTIAGO
DATE
JULY 27, 2017
I. CONCEPT OF THE METHOD
Bisection method is a root-finding method that repeatedly bisects an interval and then selects a
subinterval in which a root must lie for further processing. It is also the interval halving method, binary
method and the dichotomy method. The method is applicable for numerically solving the equation
f(x)=0 for the real variable x, where f is a continuous function defined on an interval [a,b] where f(a) and
f(b) have opposite signs, it is also called the xlower and the xupper value. In this case a and b are said to
bracket a root since, by the intermediate value theorem, the continuous function f must have at leas
one root in the interval (a,b).
II. EQUATION
Xlower must have a negative value of f(x) in order to continue the method also Xupper must have a
negative value.
+
X root = 2
f(x root) > 0 change the value of the xupper to x root value
f(x root) < 0 change the value of the xlower to xroot value
error =
if the error < 0.001 then the recent value of x root is the root of the equation
III. PROGRAM
CODE:
function [ ] = Bisection( )
f1 = input ('Enter equation: ','s');
f = inline(f1); %#ok<*REMFF1>
xl= input('Input lower limit: ');
while(f(xl)>0)
xl = input('Invalid limit, Input another value: ');
end
xu= input('Input upper limit: ');
while(f(xu)<0)
xu = input('Invalid limit, Input another value: ');
end
end
Since Bisection Method needs upper and lower limit, the user can set this by his own.
Here the limits are = ; =
This is the table of iteration where users can see the process of computing the roots.
() = 3 3 + 1 ; = 1 ; = 2
V. INTERPRETATION
Each Iteration has a different value of x roots due to the limits and the value of the f(xroot). Each
iteration changes value whether in x lower or upper. This values are depending on the sign of the
f(xroot) which if it is negative the x lower will be change to x root while vice versa in x upper. The data
shows the iteration of collection of data and the percentage error of each.
After this laboratory we can conclude that bisection method in getting roots can be made by the
computer using codes and syntaxes in MATLAB. Using loop functions and iteration bisection method
can be achieved. As of the bisection method, it is pretty accurate depending on the error set by the
programmer or sometimes the user depending on the code created.