Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create and test a MATLAB function called bisection that implements the bisection root finding method. The function specifications are given in Figure 1 below Function

image text in transcribed

Create and test a MATLAB function called bisection that implements the bisection root finding method. The function specifications are given in Figure 1 below Function Name Functionalit Input Arguments (in this order) bisection Implements bisection root-finding method -Handle to function to be searched Initial bracket lower bound -Initial bracket upper bound Maximum acceptable relative approximation error Maximum acceptable number of iterations Approximation of root location -Relative approximation error of solution -Number of iterations taken -Exit flag indicating termination status) root-bisection(fun, lb, ub, err_max, iter_max) root, err) bisection(..) [root, err, numiter] bisection(...) [root, err, numlter, exitFlag] bisection 1: algorithm terminated normally (due to error being sufficiently small) 0:algorithm terminated due to max iterations being reached 1:algorithm terminated due to invalid bracket specification (no root in bracket) 2 : algorithm terminated due to invalid return value from function fun (e.g., NaN, Inf Output Arguments' (in this order) Valid Calling Syntax Exit Flag Encoding empty bracket Notes -The function should validate the input arguments to ensure there are a sufficient number, that they are of the right types, and that they are valid (iteration max should be positive, etc.). If validation fails, use the error function to terminate execution. Assume the function being passed via the function handle takes a scalar input argument and returns a scalar output Submit: (1) Your function file, bisection.m, (2) (optional) any scripts you use to test your function Create and test a MATLAB function called bisection that implements the bisection root finding method. The function specifications are given in Figure 1 below Function Name Functionalit Input Arguments (in this order) bisection Implements bisection root-finding method -Handle to function to be searched Initial bracket lower bound -Initial bracket upper bound Maximum acceptable relative approximation error Maximum acceptable number of iterations Approximation of root location -Relative approximation error of solution -Number of iterations taken -Exit flag indicating termination status) root-bisection(fun, lb, ub, err_max, iter_max) root, err) bisection(..) [root, err, numiter] bisection(...) [root, err, numlter, exitFlag] bisection 1: algorithm terminated normally (due to error being sufficiently small) 0:algorithm terminated due to max iterations being reached 1:algorithm terminated due to invalid bracket specification (no root in bracket) 2 : algorithm terminated due to invalid return value from function fun (e.g., NaN, Inf Output Arguments' (in this order) Valid Calling Syntax Exit Flag Encoding empty bracket Notes -The function should validate the input arguments to ensure there are a sufficient number, that they are of the right types, and that they are valid (iteration max should be positive, etc.). If validation fails, use the error function to terminate execution. Assume the function being passed via the function handle takes a scalar input argument and returns a scalar output Submit: (1) Your function file, bisection.m, (2) (optional) any scripts you use to test your function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions