Question
Following is the Newtraph m-file. Thank you for your help! 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
Following is the Newtraph m-file. Thank you for your help!
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;
4. Develop an m-file for the secant method by modifying the textbook's Newtraph m-file. o The first line of your function should be: function [root] Hw5_4_lastnamefirstinitial (func, xl, x2, es, maxit, varargin) root-value of x at root, func = function, x1-1st guess, X2 = 2nd guess, es = stopping tolerance, maxit-max # iterations . What to turn in: Test your M-file using the example from class in Handout 3, slide 9. Take a screenshot of your function call and output, and paste it into your main homework file. Submit the M-file along with your main homework file directly to Canvas - 4. Develop an m-file for the secant method by modifying the textbook's Newtraph m-file. o The first line of your function should be: function [root] Hw5_4_lastnamefirstinitial (func, xl, x2, es, maxit, varargin) root-value of x at root, func = function, x1-1st guess, X2 = 2nd guess, es = stopping tolerance, maxit-max # iterations . What to turn in: Test your M-file using the example from class in Handout 3, slide 9. Take a screenshot of your function call and output, and paste it into your main homework file. Submit the M-file along with your main homework file directly to CanvasStep 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