Question: Write a function m-file that implements the secant method. Your function should accept the following inputs (in order): 1. A function defining the roots problem

 Write a function m-file that implements the secant method. Your functionshould accept the following inputs (in order): 1. A function defining the

Write a function m-file that implements the secant method. Your function should accept the following inputs (in order): 1. A function defining the roots problem 2. Avector of two initial guesses (first element is the first guess, second element is second guess) 3. A stopping criterion ( es ) for the numerical solution with a default value of 1e-5 4. A maximum iteration count for the numerical solution with a default value of 30 5. An arbitrary number of parameter values associated with the roots problem Your function should output the following four scalar outputs (in order): 1. The root estimate 2. The residual in the numerical solution 3. The approximate relative error in the numerical solution 4. The number of iterations required for convergence function [xroot, residual, ea, iter_count] student_solution(fun, xi, es,max_it, varargin)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!