Question: Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do

 Create a script file that performs the following calculations. Your scriptwill use the functions you create. Label all graphs appropriately. For this

Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's Method. It works like so: Theorem (Newton's Method). Given a continuous differentiable function f(1) and a starting point To sufficient close to a root of f, the sequence: f(Ik-1) Ik = Ik-1 f'(Ik-1) will converge to the root. Create a matlab code xn=newt(f,df,x0,n) that will use Newton's method to approximate a root of f given its derivative and a starting point to; performing n iterations. The f and df will be inputted as anonymous matlab functions. xn should be a vector containing each Ik (a) Use newton's method to find the only root of the function f(3) = 23 - 2 +1. Compare your answer with that found using MATLAB's build it solver fzero. (b) Use newton's method to estimate the cube root of 99. Start with Zo = 99 and plot (n. In) for n=1:20. (c) Create a function [xn n)-newt2(f,df, x0, err) that will continue to use newton's method until the relative error Em = 27-2m-2 is less than err. Have your function output how many iterations n it takes. Run your function with the f from part (a), err-.01 and Do = 1. How many iterations were required? Note: The functions above have you input the derivative of f. For extra credit, you can have the functions newt and newt2 calculate df on their own

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!