Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB The book has two different MATLAB versions of Newton's method. One is a program (on page 162) and the other is a function (page

MATLAB

The book has two different MATLAB versions of Newton's method. One is a program (on page 162) and the other is a function (page 170). The comments on page 162 indicate the algorithm does not work on zero roots (i.e., it does not work when the true root is equal to zero). This is the case because of the form of "myrel".

Create a variation on the function m-file (page 170) in which the zero-root restriction is removed by changing the definition of "myrel." Specifically, do not divide by x; but leave the rest the same.

Then test your modified code on the MATLAB pre-defined "sin" function (and remember your differential calculus: the derivative of sine is simply cosine).

Set the initial guess to pi/4. [You can still name the function "newtfun_LastName.m"].

Create a driver routine named "test_newtfun_LastName.m" that specifies the input arguments and calls newtfun_LastName.m.

image text in transcribedimage text in transcribed

% Newton's method in general % excludes zero roots! steps0; x input ( 'Initial guess: , ); re 1e-8; myre1 = 1; % iteration counter % estimate of root % required relative error while myrel re & (steps

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago