(Xbisection5) Callbisection1 (FX, Xleft, Xright) : Ce 5225: Numerical Techniques in Civil Engineering Tutorial 4
(Xbisection5) Callbisection1 (FX, Xleft, Xright) : Ce 5225: Numerical Techniques in Civil Engineering Tutorial 4
where; ‘fx’ is a function, ‘xLeft’, and ‘xRight’ are scalars representing the left and
right bracket, and ‘xBisection5’ is the solution to the 5th iteration. Show that
‘xBisection5’ = XXX. You must use for loop in your function. Note that the total
number of function evaluations should be n + 1, where n = 5 in this case.
(b) Write a function ‘callBisection2.m’ which additionally calculates the relative er-
ror in x for each iteration. This function will have the same input and output
arguments as ‘callBisection1.m’. The relative error is given as:
xnew,i − xnew,i-1
ϵx,i% = 100% (2)
xnew,i
Show that ϵx,5% = XXX%.
(c) Write a function ‘callBisection3.m’ that approximates the root of a function ‘fx’
such that the relative error is less than 0.1%. You should use a do-while loop
to accomplish this and complete your calculations using the minimum number of
function evaluations (f (x) evaluations). The ‘callBisection3.m’ function should
have the following input and output arguments:
[xBisection] = callBisection3(fx,xLeft,xRight,xTol)
Dr. Venkatraman Srinivasan and Dr. Alagappan Ponnalagu, IIT Madras Page 1 of 1