Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer in MatLab. Have a different script for function, and a different script for everything under prob1(). Thanks! Newton's method solves a nonlinear equation
Please answer in MatLab. Have a different script for function, and a different script for everything under prob1(). Thanks!
Newton's method solves a nonlinear equation starting from an initial approximation. The method converges to a solution that is (sometimes surprisingly) dependent on that choice of initial approximation. Two different, starting guesses might produce sequences of approximations that converge to two different roots of the equation at hand. The set of initial guesses that will make the method converge to a given root is called the basin of attraction of that root. For this problem, you will determine intervals of possible starting guesses that form the basin of attraction for each of the roots of a given function. Write a function file named NewtonMethodBasin.m for the function with the following definition: function [approxRoot, flag]= NewtonMethodBasin(f, fprime, x0, tol, maxCount) where - f, fprime are the function we are looking for the roots of and its derivative respectively - x0 is an initial guess - tol is a desired level of tolerance for approximating a root in your preferred mode of error and - maxCount is the maximum number of iterations allowed You may edit the function we have created in class. Make sure that your function (in the published product) doesn't print any messages. The function should return - approxRoot, an approximation to a root of f, if convergence was achieved; an empty vector otherwise - flag that is either 1, if the method converged, or 0, if it did not converge or there were other issues (a) fix real numbers a,b>0 and plot the graph of f(x)=a2x46abx211b2 for your chosen values. Make sure the plot range allows you to see both roots clearly. (b) call NewtonMethodBasin appropriately to find both the positive and negative root of f(x). (c) Take the interval [0, positive root +1] and split it into intervals of initial guesses for which Newton's method: - converges to the positive root - converges to the negative root o is defined, but does not converge to any root Your intervals should not contain any initial guess where f(x)=0, at which Newton's method is not defined. You will likely want to use a for loop and some conditional statements to determine the intervals. You may report the intervals for each outcome using interval notation in a commentStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started