clc f1=@(x) exp(-x)-x; f1d=@(x) -exp(-x)-1; function yy=nraphson(f,fd,x0,es,imax,ea) iter=0; xr=x0; while (ea>es) &&(iter<=imax) xrold=xr; xr=xrold-f(xrold)/fd(xrold); iter=iter+1; if ne(xr,0) ea=abs((xr-xrold)/xr)*100; end end yy=xr; end fplot(f1,[0 1],'b') grid on; r1=nraphson(f1,f1d,0.25,0.01,5,2.6); fprintf("El valor de la raiz es = %f \n",r1)