Write a matlab function called newtons method that accepts


Problem:

Newton's method is a simple algorithm for approximating the roots of an equation. This algorithm works by taking the derivative (slope) of a function at a point along that function, finding where that slope intersects the x-axis, and then repeating for this new point. Repeating this process gets us closer to the root of the actual function. We can describe Newton's method in general form by the equation:

xn+1 = xn - (f(xn)/f'(xn))

Write a MATLAB function called newtons Method that accepts two inputs and returns one output. The inputs should be a vector representation of a polynomial and an initial guess for the root. The output should be the root returned by Newton's Method. Your function should find the root within at least 6 decimal places of accuracy. Your function should also gracefully handle when f'(x) is zero (don't divide by zero) and the case when there isn't a root (don't loop forever).

Check your answer with the polynomial y = 3x2+2x-6 to generate output. Your script should perform this calculation in both of the following ways. (1) Call your newtons Method function twice with these two guesses: 1 and -1. (2) Use the roots() function on your polynomial. Print all solutions to 6 decimal places.

Additional information

This problem belongs to MATLAB software and discusses about application of MATLAB in mathematics to find area of a tea spill using numerical integration.

Answer is in MATLAB format

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Write a matlab function called newtons method that accepts
Reference No:- TGS01372469

Now Priced at $30 (50% Discount)

Recommended (97%)

Rated (4.9/5)