Question: 3.16 Write a MATLAB user-defined function that solves for a root of a nonlinear equation f(x)-0 using the bisection method. Name the function Xs BisectionRoot(Fun,a,

3.16 Write a MATLAB user-defined function that solves for a root of a nonlinear equation f(x)-0 using the bisection method. Name the function Xs BisectionRoot(Fun,a, b). The output argument Xs is the solution. The input argument Fun is a name for the function that calculates f(x) for a given x (it is a dummy name for the function that is imported into BisectionRoot); a and b are two points that bracket the root. The iterations should stop when the tolerance in f(x) (Eq. (3.5)) is smaller than 0.000001. The program should check if points a and b are on opposite sides of the solution. If not, the program should stop and display an error message. Use BisectionRoot to solve Problem 3.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
