Question: Write a MATLAB function that implements the Newton-Raphson method. The function should have the form function xr = NewtonRaphson(f,df dx,xi,es, imax), where f is a

 Write a MATLAB function that implements the Newton-Raphson method. The function

Write a MATLAB function that implements the Newton-Raphson method. The function should have the form function xr = NewtonRaphson(f,df dx,xi,es, imax), where f is a function handle that defines the root-finding problem f(x) = 0, df dx is a function handle for the derivative off, xi is the initial guess, es is the stopping criterion for the relative approximate error defined in class, and imax is the maximum number of allowable iterations. The value of the root is returned in the output argument xr. The function should print the root value, the number of iterations used and the value of the percent approximate error for the last iteration in the command window in a nicely formatted way. In addition, it should substitute the value of the root into the original function and display the result, to check if it makes sense. It should also warn the user in case it had to stop because f'(x_ i) = 0 (and not because the root was found)

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!