0% found this document useful (0 votes)
9 views7 pages

Lab Report 06

The document outlines the implementation of the Bisection and False Position methods for finding roots of polynomial equations using MATLAB. It explains the theory behind each method, detailing the steps involved in the Bisection method and contrasting it with the False Position method, which utilizes linear interpolation. MATLAB code snippets for both methods are provided, demonstrating how to execute the algorithms and check for convergence.

Uploaded by

pubg pubg
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)
9 views7 pages

Lab Report 06

The document outlines the implementation of the Bisection and False Position methods for finding roots of polynomial equations using MATLAB. It explains the theory behind each method, detailing the steps involved in the Bisection method and contrasting it with the False Position method, which utilizes linear interpolation. MATLAB code snippets for both methods are provided, demonstrating how to execute the algorithms and check for convergence.

Uploaded by

pubg pubg
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
You are on page 1/ 7

Lab 06 Bisection & False Position

Lab Report 06
Objective:
Implementation of Bisection method and False Position method in coding form to find the value
of unknown in MATLAB.

Theory:

• Bisection Method:
The bisection method is used to find the roots of a polynomial equation. It separates the
interval and subdivides the interval in which the root of the equation lies. The principle behind
this method is the intermediate theorem for continuous functions. It works by narrowing the gap
between the positive and negative intervals until it closes in on the correct answer. This method
narrows the gap by taking the average of the positive and negative intervals. It is a simple
method and it is relatively slow. The bisection method is also known as interval halving method,
root-finding method, binary search method or dichotomy method.

Let us consider a continuous function “f” which is defined on the closed interval [a, b], is given
with f(a) and f(b) of different signs. Then by intermediate theorem, there exists a point x belongs
to (a, b) for which f(x) = 0.

Bisection Method Steps:

Follow the below procedure to get the solution for the continuous function:

i. Calculate c, the midpoint of the interval, c = a + b/2.


ii. Calculate the function value at the midpoint, f(c).
iii. If convergence is satisfactory (that is, c - a is sufficiently small, or |f(c)| is sufficiently
small), return c and stop iterating.
iv. Examine the sign of f(c) and replace either (a, f(a)) or (b, f(b)) with (c, f(c)) so that there
is a zero crossing within the new interval.

Repeat above three steps until f(t) = 0.

The bisection method is an approximation method to find the roots of the given equation by
repeatedly dividing the interval. This method will divide the interval until the resulting interval is
found, which is extremely small.

Page |1
Lab 06 Bisection & False Position

MATLAB Code:
>>clc

>>close all

>>clear all

>>xl=input('Enter Lower Boundary limit: ');

>>xu =input ('Enter Upper Boundary limit: ');

>>n= input('Enter number of iteration ');

>>fx1= (668.06/xl)*(1-exp(-0.146843*xl))-40;

>>fxu= (668.06/xu) *(1-exp(-0.146843*xu))-40;

>>if fx1*fxu<0

>>disp('Guees is right')

>>else

>>disp('your guess is wrong')

>>break

>>end

>>for i=1:1:n

>>xr(i)=(xl+xu)/2;

>>fx1= (668.06/xl)*(1-exp(-0.146843*xl))-40;

>>fxu= (668.06/xu)*(1-exp(-0.146843*xu))-40;

>>fxr(i)=(668.06/xr(i))*(1-exp(-0.146843*xr(i)))-40;

>>if fx1*fxr (i) <0

>>xu=xr (i);

>>else if fx1*fxr(i)>0

>>xl=xr(i);

>>else

Page |2
Lab 06 Bisection & False Position

>>xr(i)

>>end

>>end

>>if i>1

>> e(i)= ((xr(i)-xr(i-1))/xr(i))*100;

>>e(i-1)

>>if norm (e(i))<.02

>>xr(i-1)

>>break

>>end

>>end

>>end

Screenshots:

Input:

Page |3
Lab 06 Bisection & False Position

Output:

• False Position Method:


This is one of the iterative methods that give you the root if the function changes its
sign: from positive to negative or from negative to positive. Despite the fact that bisection
is an entirely legitimate strategy for determining roots, its “brute force” approach is
generally inefficient. False position is based on graphical approach. A shortcoming of the
bisection method is that, in dividing the interval from xl to xu into equivalent parts, no
record is taken of the values of f (xl) and f (xu).

For instance, if f (xl) is very near to zero than f (xu), it is just like that the root is
nearer to xl than to xu (as shown in the figure below). An alternate method that exploits
this graphical understanding is to join f (xl) and f (xu) by a straight line. The intersection
of this line with the x-axis gives an improved version of the root.

The way that the substitution of a curve by a straight line gives a “false position” of
the root is the actual point of the name, method of false position, or in Latin, regula falsi
method. It is additionally called the linear interpolation method. Because it takes the
same approach where two points of a function are joined with a straight line.

Page |4
Lab 06 Bisection & False Position

Difference b/w False Position and Bisection:

The difference between bisection method and false-position method is that in bisection
method, both limits of the interval have to change. This is not the case for false position method,
where one limit may stay fixed throughout the computation while the other guess converges on
the root.

MATLAB Code:

>>clc
>>clear all
>>close all
>>xl= input('Enter value of lower boundary limit');
>>xu= input('Enter value of upper boundary limit');
>>n= input('Enter number of iteration');
>>fxl=(668.06/xl)*(1-exp(-0.146843*xl))-40;

Page |5
Lab 06 Bisection & False Position

>>fxu=(668.06/xu)*(1-exp(-0.146843*xu))-40;
>>if fxl*fxu<0
>> disp('Guess is right')
>>else
>> disp('Guess is wrong')
>> break
>>end
>>for i=1:1:n
>> fxl=(668.06/xl)*(1-exp(-0.146843*xl))-40;
>> fxu=(668.06/xu)*(1-exp(-0.146843*xu))-40;
>> xr(i)=xu-(((fxu)*(xl-xu))/(fxl-fxu))
>> fxu=(668.06/xu)*(1-exp(-0.146843*xu))-40;
>> fxr(i)=(668.06/xr(i))*(1-exp(-0.146843*xr(i)))-40;
>>if fxl*fxr(i)<0
>> xu=xr(i)
>> else if fxl*fxr(i)>0
>> xl=xr(i)
>> else
>> xr(i)
>> end
>> end
>> if i>1
>> e(i)=((xr(i)-xr(i-1))/xr(i))*100;
>> e(i-1)
>> if norm(e(i))<.02
>> xr(i-1)
>> break

Page |6
Lab 06 Bisection & False Position

>> end
>> end
>>end
MATLAB Screenshots:
Input:

Output:

Page |7

You might also like