Question: MATLAB Write a code bisect.m that implements the bisection method for finding a root of F(x) = 0 in an interval [a , b] to
MATLAB
Write a code bisect.m that implements the bisection method for finding a root of F(x) = 0 in an interval [a , b] to a given accuracy. ? The code should accept inputs: a , b, TOL , should print out the iterates: n x F(x) ERRn (neatly, in columns, use format: %d %f %e %e ), ? and upon convergence it should print out the value of the root, the residual, the error and how many iterations it took. ? The (formula for the) function F(x) should be coded in a function subprogram: function y = FCN(x) ? You may set maxIT=100; in the code. ? Of course, you must debug the code (on a simple problem with known solution).
Now use your bisection code on the cubic (
), with the following inputs: ? ? a. a, b, TOL: 1 , 2 , 1.e-6 ? ? b. a, b, TOL: 1 , 2 , 1.e-15 ? ? c. a, b, TOL: -4 , 4 , 1.e-6 and 1.e-15
F(x) = x3 + x2-3x-3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
