Question: Matlab code: I have given the Problem, Original Code and a partial answer to the problem. Please show all work and all steps for Problem
Matlab code: I have given the Problem, Original Code and a partial answer to the problem. Please show all work and all steps for Problem no# I would like the updated matlab code to fully run without errors to give me the answer.
Question no
Modify the userdefined function Bisection so that the table is not generated and the outputs are the approximate root and the number of iterations needed for convergence. All other parameters,including default values, are to remain unchanged. Save this function as Bisection
Execute Bisection to find the root of in the interval
Partial Solution given:
f @xsinxcosx;
ck Bisectionf
c
k
Orginal Code Given:
function c Bisectionf a b kmax, tol
Bisection uses the bisection method to approximate a root of fx
in the interval ab
c Bisectionf a b kmax, tol where
f is an anonymous function representing fx
a and b are the endpoints of interval ab
kmax is the maximum number of iterations default
tol is the scalar tolerance for convergence default e
c is the approximate root of fx
if nargin isemptytol tol e; end
if nargin isemptykmax kmax ; end
if fafb
c 'failure';
return
end
disp k a b c ba
for k :kmax
c ab; Find the first midpoint
if fc Stop if a root has been found
return
end
fprintfi ffff
kabcba
if ba tol Stop if length of interval is within tolerance
return
end
if fbfc Check sign changes
b c; Adjust the endpoint of interval
else
a c;
end
end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
