Question
MATLAB (Octave) Question The bisection method is useful for finding the roots of equations and works by having the user guess a lower and upper
MATLAB (Octave) Question
The bisection method is useful for finding the roots of equations and works by having the user guess a lower and upper bound. The midpoint between the two bounds is then determined, and the program determines whether the midpoint should become the new lower bound or upper bound. After a number of steps, the program finds the root value.
For this assignment, create a program that performs the bisection method. The program will take as input arguments the function that you are finding the root for (use an anonymous function), the two bounds, the maximum number of iterations, and the tolerance for error.
Your program will continue to operate until the function value is less than the tolerance for error.
Your function must perform some error checking:
a) check to make sure that the user input bounds that contain a root
b) display a message if the maximum number of iterations is exceeded
c) display an error message if the upper bound is smaller than the lower bound.
Find the root or roots to the following functions with your program. If the function has no root, then state that as well:
i) 8-4*(x-sin(x))
ii) 3*x^2-5
iii) 4*x.^3+3*sin(x)-1
In order to find all of the roots,
-Remember that you must include a wide enough range in the bounds
-You may have to try different bounds to find different roots
-It may be helpful to plot the functions
Please be as simple as possible and complete in full.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started