Question: Here is the code given for the bisection method: clc; clear all; close all; % Parameters xl = 1 2 ; % lower bound xu

Here is the code given for the bisection method:
clc;
clear all;
close all;
% Parameters
xl =12; % lower bound
xu =16; % upper bound
es =5e-2; % tolerance
imax =1000; % max iteration
% Initialization of the plot
figure;
xlabel('Iteration');
ylabel('Approximate Relative Error (%)');
title('Error vs Iterations');
hold on;
xlim([035]);
set(gca, 'YScale', 'log');
grid on;
% Find root
[xx1, iter1]= Bisect(xl, xu, es, imax);
% Bisection Method
function [xx, iter]= Bisect(xl, xu, es, imax)
% Initialization
iter =0;
xr = xl;
ea =100;
% Graph shows 35 iterations
for iter =1:35
% Step 2: update root
xrold = xr;
xr =(xl + xu)/2;
% Step 3: error
if xr ~=0 && iter >1
ea = abs((xr - xrold)/ xr)*100;
end
%Plot relative error
semilogy(iter, ea,'bo');
% Step 4: Update Boundary
test = f(xl)* f(xr);
if test 0
xu = xr;
elseif test >0
xl = xr;
else
ea =0;
end
end
xx = xr;
end
Part 1:
Modify the MATLAB script of the Bisection Method function for the False-position Methodwith minimum function evaluations. You may read about minimum function evaluation in textbook page 135, section 5.3.2. The only diIerence between the Bisection and False-position method is how you get the root at each iteration in step 2.=> Fill the right column in the table below with your script
Bisection Method -xl+xu2
False Position Method: f(xu)(xl-xu)f(xl)-f(xu)
 Here is the code given for the bisection method: clc; clear

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!