Write a matlab function newtonraphson
Course:- MATLAB Programming
Reference No.:- EM13166978

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> MATLAB Programming

Write a MATLAB function newtonRaphson(fx, x0, sigfig, maxIT) that will return a root of the function f(x) near x=x0 using the Newton-Raphson method, where sigfig is the accuracy of the solution in terms of significant figures, and maxIT is the maximum number of iterations allowed. In addition to the root (xr), the function newtonRaphson is expected to return the number of iterations and an error code (errorCode). As such, the first line of the function m file newtonRaphson.m must read as:
function [xr, nIT, errorCode] = newtonRaphson(fx, x0, sigfig, maxIT)
Include comments and necessary checks against divergence, and divide by zero situations.
Use a subfunction to calculate the derivatives.

Put your comment

Ask Question & Get Answers from Experts
Browse some more (MATLAB Programming) Materials
Write a MATLAB program that ?nds one root of a polynomial equation using the Bisection method. A script ?le in MATLAB is a ?le that contains a sequence of MATLAB statements.
Write a program to calculate the geometric mean of numbers entered by a user. The program should prompt the user to enter numbers and continue to accept the numbers until th
Write a function file, that accepts values of x as inputs and outputs the value of y when the input is passed through the following function. Evaluate the function at a range
Write the modified text file with the same name as the original file, but preprended with 'new_'. For instance, if the input filename was 'data.txt', the output filename wou
The Travelling Salesman problem involves a salesman who has to visit a number of cities in a single closed tour. The salesman always starts and ends the tour in his home city
Create a function called "hollowSphere" that calculates the volume using the formula shown in Problem I. Then write a script that prompts the user for the value of the inner
ECE 452 - Derive the stability condition for each of the above time discretization methods and Derive the FD equations for nodes on the left, right, top and bottom boundaries.
Write a function called small_elements that takes as input an array named X that is a matrix or a vector. The function identifies those elements of X that are smaller than t