Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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