Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 Canvas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions