You are on page 1of 1

NEWTON RAPHSON METHOD

Table of Contents
INPUT .............................................................................................................................. 1
PROGRAM & RESULT ...................................................................................................... 1

Name of the Student :Shubham Chapparghare Roll.No. :351013

INPUT
SC_NRM(@(x)exp(x)-sin(x),@(x)exp(x)-cos(x),@(x)exp(x)+sin(x),2,0.00001,100)

PROGRAM & RESULT


function[]=SC_NRM(fun1,fun2,fun3,x0,acc,maxitr)
y1=feval(fun1,x0);
y2=feval(fun2,x0);
y3=feval(fun3,x0);
while (y1*y3/(y2)^2>1)
x0=input('enter new value of x0:');
y1=feval(fun1,x0);
y2=feval(fun2,x0);
y3=feval(fun3,x0);
end
itr=1;
while itr<=maxitr
x1=x0-y1/y2;
y1=feval(fun1,x1);
y2=feval(fun2,x1);
if abs(x1-x0)>acc
x0=x1;
y1=feval(fun1,x1);
y2=feval(fun2,x1);
itr=itr+1;
else
break;

end
end
x1=x0-y1/y2;
fprintf('The value of root of given function is:%f\n',x1)

The value of root of given function is:-3.183063

Published with MATLAB® R2017a

You might also like