1. Engineering
  2. Computer Science
  3. please post code i have provided the template as well...

Question: please post code i have provided the template as well...

Question details

Please post code i have provided the template as well

84 CHAP. 2 THE SOLUTION OF NONLINEA k EQUATIONS y(x) 0 Program 2.5 (Newton-Raphson Iteration). To upproximate a rool of f (x) given one initial approxirnation po and using the iteration 0; for k드1, 2 , f (P 1) function [po,err,k,yl neton (,df ,po,delta,epailon,zaxi) %Input - f is the object function input as a string - df is the derivative of f input as a string df -pois the initial approximation to a zero of f - delta ie the tolerance tor po epeilon 18 the tolerance for the uhctioa values y - maxi is the marlu number of irerations XOutput po is the evton-Raphson approxination to the zero err is the error estizste tor po -k i8 the punber of iterations - y is the function value f (po) for k-1:maxi err abs (pl-po); relerr-2err/(abe(pt)+delta) po-pl; y-teval (f,po); it Cerr<delta) I (relerr<delta)l (abs (y) <epailon), hreak, end end

BME 301-Helms Tillery-Spring 2019 HOMEWORK #3 Due February 1at 11:59 pm One way to evaluate Va is to use the Newton-Raphson method to find the zeros of the function f(x) 13. 1. x3 - a starting at xo a. Use this approach to find the cube root of [5 points] Write MATLAB code to show how you would use the NR method to find the roots of f, starting at o 13. Show how the solution proceeds by plotting your estimate for Va as a function of iteration number. How many iterations were require for the sequence to converge? a. b. [5 points] Does the process work if you start at xo13? Modify your code and using the output make a plot of the estimate of Va as a function of iteration number for this starting point. How many iterations does this take? c. [3 points] Why does the process fail if you start at xo 0? d. BONUS [5 points] Make a plot of the NR iteration function g(x) over the range [-15,15] g(x)x- f (x) Apart from x 0, what would be bad choices of starting point for the Newton- Raphson method? Why? NB: Remember to include any code or functions you wrote in your answers to question 1. To obtain full points for this question, you must include in your code i) tests that stop the iterative procedure when convergence has been reached, ii) a maximum number of iterations in your code to avoid the chance that your code may get into an infinite loop. ii) you will also need to check for derivatives close to zero to avoid to division by zero, so that your code exits elegantly if that happens. What alternative method will your code use if the derivative becomes close to zero?

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution