disp (' This is the code of Newton-Raphson method.Is writen by Ali Ashouri') disp (' ') disp (' ') disp (' ********Before enter anything read all of introduction that will write. read all of them*******') disp (' ') format long disp (' x must be at double class and before play the program write its limit in commond window. like: x=-1:0.00001:1') disp (' ') disp (' at first calculate the differential of function which used in this method.so write at commond window:') disp (' ') disp (' syms y;') disp (' diff(f(y)) ------- f(y) is your function at term like sin(y) or y.^2') disp (' ') disp (' ') disp (' then y must be at double class and write its limit in commond window. like: y=-1:0.00001:1') disp(' ') disp (' function should be start by @(x) like : @(x) sin(x)') disp (' ') disp (' ') disp (' Differential function should be start by @(y) like : @(y) cos(y)') disp (' ') f=input('enter your function: '); h=input('enter your differential of function: '); d=input('enter the epsilon number : '); q=input('enter the initial number : '); tic double (x); n=1; c=q-f(q)./h(q); disp('n I x0 I x I f(c)') disp ------------------------------------------------------------------------------------------------------------------------------------ r=[num2str(n),' I ',num2str(q),' I ',num2str(c),' I ',num2str(f(c))]; disp (r) while abs(f(c))>=d q=c; c=q-f(q)./h(q); n=n+1; r=[num2str(n),' I ',num2str(q),' I ',num2str(c),' I ',num2str(f(c))]; disp (r) end; disp (' ') disp ([' c= ',num2str(c)]) disp ([' n= ',num2str(n)]) toc;