Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HW 2 - Q 2 ) MATLAB, PLEASE MAKE CODE COPYABLE Bisect vs . False position Copy the bisect function and modify it to create
HWQ MATLAB, PLEASE MAKE CODE COPYABLE
Bisect vs False position
Copy the bisect function and modify it to create a false position function. Compute the roots of the
function
and the number of iterations required as described below. Use an error tolerance of You
will need to modify both functions to include the number of iterations as an output to the functions.
Modify the false position function to add a max iteration parameter. If the number of iterations
exceeds the maximum number of allowed iterations, the algorithm should stop and return the
current value for the root.
a Plot the function between and
b Compute the root between and for both methods. Limit the false position method to
iterations. Display a table in the command window with the following columns:
Method, Root, and Iterations. Display the root with decimal places. Just above the
table, use an fprintf statement to display a statement such as:
"Using and as the bounds". After the table, explain the difference in the number of
iterations between the two methods as text.
c Create the table again but use and as the bounds. Explain the difference in the
number of iterations between part and for the False Position method as text.
d Plot all solutions in the figure from part a using:
Bisection part b: a red asterisk
Bisection part c: green asterisk
False Position part b: a red square
False Position part c: a green square
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