Question: Write a script to make this code work in matlab function x = Newton_method (f, df, x0, Tol, MaxIter ) % NEWTON Newton's Method Newton's
Write a script to make this code work in matlab
function x = Newton_method (f, df, x0, Tol, MaxIter ) % NEWTON Newton's Method Newton's method for finding successively better approximations to the zeroes of a real-valued function. % Inputs: f - solve f(x)3D0 df derivative of f(x) initial guess X0 Tol - stopping tolerance MaxIter - maximum number of iterations % Output: X - a root of f (x)%3D0 nit=0;%number of iterations disp('step| disp(' while 1 X f(x) ') creat a script for this code on matlab x = x0 - f(x0)/df(x0); nit=nit+1; if nit>MaxIter disp('Maximum number of iterations is reached!') break end if abs(x-x0)
Step by Step Solution
3.35 Rating (164 Votes )
There are 3 Steps involved in it
THIS IS THE MATLAB CODE FOR CALLING THE FUNCTION Newtonmethod clc clear all to clear a... View full answer
Get step-by-step solutions from verified subject matter experts
