Purchase Solution

Newton-Raphson Algorithm Implemented in Matlab

Not what you're looking for?

Ask Custom Question

a. Write a Matlab function newton.m which uses Newton-Raphson algorithm to compute an approximate solution to the equation f(x) = 0 starting from X0 and stopping when the magnitude of f(x) becomes smaller than e. The program should also restrict the maximum number of iterations to N. Your m-file should have a header line function [x, nitr] = newton (f, fp, x0, e, N) where fp is a user supplied function that computes f'(x).

Note: You can use Algorithm 2 on page 52 of Steven Pav's lecture notes as a template for your program.

b. Use your function newton.m to find the positive root of a function f(x) = exp(x) - sin(x) -2 with at least 10 correct digits after the decimal point. How many iterations did the algorithm require to converge the result.

See attachment .

Attachments
Purchase this Solution

Solution Summary

This solution implements a Newton-Raphson algorithm Matlab, using two separate scripts for the function whose zeros are sought and its derivative, and using the algorithm in a demo script.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.