You are on page 1of 14

Computational Methods in Process

Engineering(CHE3001)
Lab Asessment-01

Dr. Bandaru Kiran


Assistant Professor Sr.
SCHEME
VIT Vellore
Mob: 7981343089
Asessment-01

• AIM: Develop a MATLAB code for bisection and Regula


false position method
Problem: Determine the drag coefficient (C)needed for a
parachutist of mass m=68.1 kg to have a velocity of 40 m/s
after free falling for time t = 10 s.
• Note: The acceleration due to gravity is 9.81 m/s^2.
Things to Submit in the Report

• AIM
• Theory
• Algorithm
• Code
• Results And Discussions
• Conclussions
Algorithm for the bisection method
Step - 1

Choose x and xu as two guesses for the root such that f ( x ) f ( xu )  0 , or in other words,
f (x) changes sign between x and xu
Step - 2
Estimate the root, xm , of the equation f ( x)  0 as the mid-point between x and xu as

Step - 3
Now check the following
a) If f ( x ) f ( xm )  0 , then the root lies between x and xm ; then x  x and
xu  x m .
b) If f ( x ) f ( xm )  0 , then the root lies between xm and xu ; then x  xm and
xu  xu .
c) 5 If f ( x ) f ( xm )  0 ; then the root is xm . Stop the algorithm if this is true.

CHE3001 Computational Methods in Process Engineering


Step - 4
Find the new estimate of the root
x x
xm =  u
2
Step - 5
Find the absolute relative approximate error as
xmnew - xmold
a = new
 100
xm
where
xmnew = estimated root from present iteration
xmold = estimated root from previous iteration

Compare the absolute relative approximate error a with the pre-specified relative error tolerance s

If a s , then go to Step 3, else stop the algorithm.


6

CHE3001 Computational Methods in Process Engineering


Regula falsi or false position method
• Also named as method of false position or linear
interpolation method
Concerns in Bisection method

Convergence process in the bisection method is very slow

It depends only on the choice of end points of the interval [a,b].

The function f(x) does not have any role in finding the new bound value
xm or xr

Condition of flase position method

 Function f(x) is a real and continuous between the interval xl and xu

 The functions f(xl) and f(xu) have opposite sign


7 i.e. if f(xl) f(xu) < 0

CHE3001 Computational Methods in Process Engineering


False position method - Basics
• A better approximation of xm or xr can be obtained by
taking the straight line or chord joining the points (xl,
f(xl) and xu, f(xu)) intersecting the x-axis.

Properties of similar triangle

D C
B C
E

A E

Two triangles ABC and EDC B C


AB BC f ( xl ) xm  xl D
=  
ED DC
8 f ( xu ) xm  xu A

CHE3001 Computational Methods in Process Engineering


From the two similar triangles, we get

0  f ( xl ) 0  f ( xu )
 Triangle 1 Triangle 2
xm  xl xm  xu

Rearranging the above equation


 xm  xl  f  xu    xm  xu  f  xl 

xu f  xl   xl f  xu   xm  f  xl   f  xu 

xu f  xu   xl f  xu 
xm 
f  xl   f  xu 
(or)

f  xu  ( xl  xu )
xm  x9 U 
f  xl   f  xu 
CHE3001 Computational Methods in Process Engineering
Algorithm for false position method
Step - 1
Choose x L and xU as two guesses for the root such that f x L  f xU   0 , or in other
words, f x  changes sign between x L and xU .

Step - 2

Estimate the new root, xr or xm , of the equation f x   0 from the derived


expression for false position method
One less function
f  xU  ( xL  xU ) evaluation than the
xm (or) xr  xU  other expression
f  xL   f  xU 
Step - 3
Check the condition
If f x L  f xm   0 , then the root lies between x L and xm ; then xL  xL and xU  xm
If f x L  f xm   0 , then the root lies between xm and xU ; then x L  xm and xU  xU
If f x L  10
f xm   0 , then the root is xm , Hence stop the algorithm

CHE3001 Computational Methods in Process Engineering


Step - 4
Find the new estimate of the root
f  xU  ( xL  xU ) This becomes xmold for next iteration and
xm  xU 
f  xL   f  xU  the newly calculated value becomes xmnew

Step - 5
Find the absolute relative approximate error
where
xnew
x old
xmnew = estimated root from present iteration
a  m
new
m
 100
x m x mold = estimated root from previous iteration

Compare the absolute relative approximate error a with the pre-specified relative error tolerance s

If a s , then go to Step 3, else stop the algorithm.


Note: Algorithmn in similar to bisection method except the formula to find the
new estimate.
CHE3001 Computational Methods in Process Engineering 11
Matlab Code: Bisection and Regula False
function Bisecion_labsession2 if f(xu)*f(xr)<0
%function [ ]=Nameof the file(inputs) xl=xr;
syms c else
f(c)=(668.06/c)*(1-exp(-0.146843*c))-40; xu=xr;
xl=10;xu=16; end
tol=0.001;
if f(xu)*f(xl)<0
if f(xl)*f(xr)<0
xu=xr;
else
else
disp('initial guesses are wrong')
xl=xr;
% fprintf('The guess is incorrect! Enter new end
guesses\n');
xnew(1)=0;
% xl=input('Enter the first value of guess
interval:\n') ; xnew(i)=xr;
% xu=input('Enter the end value of guess if abs((xnew(i)-xnew(i-1))/xnew(i))<tol
interval:\n'); break;
end end
fprintf('f(xu)=%f', f(xu)) i
fprintf('f(xl)=%f', f(xl)) xr
for i=2:1000
end
fprintf('My exact root for the given problem is:
xr=(xu+xl)/2;% Bisection Method
%f',xr)
%xr=xu-((f(xu)*(xl-xu))/(f(xl)-f(xu)));% Regula
Falsi
• (668.06/c)*(1-exp(-0.146843*c))-40==0

You might also like