Question: Implement in Matlab the secant method for finding roots by modifying the newtraph.m code discussed in class (which implements the Newton-Raphson method). function [root, ea,
Implement in Matlab the secant method for finding roots by modifying the newtraph.m code discussed in class (which implements the Newton-Raphson method).

function [root, ea, iter]=newtraph(func,dfunc, xr, es,maxit,varargin) % newtraph: Newton-Raphson root location zeroes % [root, ea, iter]=newtraph(func,dfunc,xr, es,maxit,p1,p2, ...): uses Newton-Raphson method to find the root of func % input: func = name of function % dfunc = name of derivative of function xr = initial guess es = desired relative error (default = 0.0001%) maxit = maximum allowable iterations (default = 50) p1,p2,... = additional parameters used by function % output: % root = real root ea = approximate relative error (%) iter = number of iterations if (nargin= maxit) break end end root = xr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
