Question: Develop a MATLAB function that gives the user the choice to find the root(s) of an equation using one of the four methods (a) Bisection

Develop a MATLAB function that gives the user the choice to find the root(s) of an equation using one of the four methods (a) Bisection methood (b) False position method (c) Newton Raphson method (d) Secant method e) Modified secant method The first line in the m-file defining the function is function root-rootAll (func,prt,es,mitr) The function should return only one output, root, which is the root of the function func is the function to be solved, defined using an @ function handle. It is the only required inputs and all other inputs are optional The rest three inputs are optional prt: it is an optional input that indicates whether to print the results or not o prt nil, [], or 0 prt = 1 default, don't print Print using fprintf in the following format Method: False position Root: 2.375903 Error: 1.23e-5 # iter: 21 a es: desired error, i.e. stopping criterion. The default value is le-4 miter: maximum number of iterations. The default value is 50 Calling rootAll results in prompting the user to enter the method. Use menu function with 6 options. The first 5 are the methods and the last (otherwise) exits the program. Additional needed inputs that are specific to each of the methods are requested from the user. For example, if the Newton Raphson method is selected, the user is prompted to enter the derivative of the function. dr and the initial guess, xo Develop a MATLAB function that gives the user the choice to find the root(s) of an equation using one of the four methods (a) Bisection methood (b) False position method (c) Newton Raphson method (d) Secant method e) Modified secant method The first line in the m-file defining the function is function root-rootAll (func,prt,es,mitr) The function should return only one output, root, which is the root of the function func is the function to be solved, defined using an @ function handle. It is the only required inputs and all other inputs are optional The rest three inputs are optional prt: it is an optional input that indicates whether to print the results or not o prt nil, [], or 0 prt = 1 default, don't print Print using fprintf in the following format Method: False position Root: 2.375903 Error: 1.23e-5 # iter: 21 a es: desired error, i.e. stopping criterion. The default value is le-4 miter: maximum number of iterations. The default value is 50 Calling rootAll results in prompting the user to enter the method. Use menu function with 6 options. The first 5 are the methods and the last (otherwise) exits the program. Additional needed inputs that are specific to each of the methods are requested from the user. For example, if the Newton Raphson method is selected, the user is prompted to enter the derivative of the function. dr and the initial guess, xo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
