Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DO THIS IN MATLAB Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately.

DO THIS IN MATLAB

image text in transcribedimage text in transcribed

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

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

=+such as the dirigenti in Italy?

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago