Question: Need help with a Matlab function, must use while and if statements, cannot use 'return' Write a MATLAB function, called Newtons_method that inputs a function,

Need help with a Matlab function, must use while and if statements,Need help with a Matlab function, must use while and if statements, cannot use 'return'

Write a MATLAB function, called Newtons_method that inputs a function, f, its derivative f', an initial guess Xo, an error tolerance, tol, and a maximum number of iterations, N, and outputs the root of f obtained using Newton's method (denoted by c), starting with xo. Your function should have an error defined by err = |xn Xn-1), and stop when the error is less than the tolerance, or if the number of iterations exceeds N - whichever happens first. Your function header should look something like: function [c,n, err] = Newtons_method(f, fp,x0,N, tol) n is the last iteration when you stop

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!