Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions