Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Matlab function, called Newtons_method that inputs a function, f, it's derivative f, an initial guess x0, an error tolerance, tol, and a maximum

image text in transcribed

Write a Matlab function, called Newtons_method that inputs a function, f, it's derivative f, an initial guess x0, an error tolerance, tol, and a maximum number of iterations, N, and outputs the root of f obtained using Newton's method (denoted by c), starting with x0. Your function should have an error defined by err =xnxn1, and stop when the error is less than the tolerance, or if the number of iterations exceeds N - whichever happens first. Your function header should look something like: function [c,n,err]= Newtons_method (f,fp,x, tol, N) n is the last iteration when you stop. Use the function you created to find the root of the equation arctanx=1 with initial guess x0=2, to an accuracy of less than tol =108. Did your method converge, and if so, how many iterations did it take? If not, why didn't it converge, and what happened-did it diverge, or end up in an infinite loop?Plot on the same graph the function and the axis y=0. Test with x0=2. What is happening

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_2

Step: 3

blur-text-image_3

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

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

Students also viewed these Databases questions

Question

To solve p + 3q = 5z + tan( y - 3x)

Answered: 1 week ago