Bisection method is root finding method of non-linear equation in numerical method. It is also known as binary search method, interval halving method, the binary search method, or the dichotomy method and Bolzano’s method. Bisection method is bracketing method because its roots lie within the interval. Therefore, it is called closed method. This method is always converge. The disadvantage of this method is that it is slow compare than other numerical methods to solve nonlinear equation.
At here, we write the code of Bisection Method in MATLAB step by step. MATLAB is easy way to solve complicated problems that are not solve by hand or impossible to solve at page. MATLAB is develop for mathematics, therefore MATLAB is the abbreviation of MATrix LABoratory.
At here, we find the root of the function f(x) = x2-2 = 0 by using Bisection method with the help of MATLAB.
MATLAB Code of Bisection Method
clear all;
close all;
clc;
f=inline('x^2-2');
a=input('Enter a=');
b=input('Enter b=');
tol=input('Enter tolerance=');
itr=input('Enter number of iteration=');
p=0;
for i=1:itr
m=(a+b)/2;
if abs(a-b) < tol
p=1;
k=i;
break;
else
if f(a)*f(m)<0
b=m;
else
a=m;
end
end
end
if p==1
fprintf('Solution is %f at iterations %i',m,k)
else
fprintf('No convergent solution exist in the given number iteration')
end
Other Numerical Methods with MATLAB Coding
- Bisection Method with MATLAB
- Newton Raphson Method with MATLAB
- Secant Method with MATLAB
- Regula Falsi Method with MATLAB
- Fixed Point Iteration with MATLAB
- Trapezoidal Rule with MATLAB
- Simpson 1/3 Rule with MATLAB
- Simpson 3/8 Rule with MATLAB
- Bool’s Rule with MATLAB
- Weddle’s Rule with MATLAB
- Euler Method with MATLAB
- Modified Euler Method with MATLAB
- Midpoint Method with MATLAB
- Runge-Kutta Method with MATLAB
- Millen’s Method with MATLAB
- Adams Bashforth Moulton Method with MATLAB
- Newton Forward Difference Interpolation with MATLAB
- Newton Backward Difference Interpolation with MATLAB
- Lagrange Interpolation with MATLAB
- Newton Divided Difference Interpolation with MATLAB
- Hermite Interpolation with MATLAB
- Natural Cubic Spline Interpolation with MATLAB
- Gauss Jacobi Method with MATLAB
- Gauss Seidal Method with MATLAB
- Power Method with MATLAB