disp('POR EL METODO DE NEWTON RAPHSON') n= input('Ingrese precisin de cifras significativas n= '); xi=input('Ingrese valor inicial xi= '); g=input ('Ingrese el valor de la gravedad g= '); c=input ('Ingrese el valor del coeficiente de arrate c= '); t=input ('Ingrese el tiempo t= '); v=input ('Ingrese el valor de la velocidad v= '); Es=0.001; Ea=100; i=0; while Ea>Es xa=xi; fxi=g*xi/c*(1-exp(-c*t/xi))-v; dxi=g/c*(1-exp(-c*t/xi))-g*t/xi*exp(-c*t/xi); xi=xi-fxi/dxi; Ea=abs((xi-xa)/xi)*100; i=i+1; end fprintf('El valor de la masa es: %12.15f/n',xi) fprintf('Numero de iteraciones: %12.0f/n',i)
Corrida y prueba del programa Newton Raphson
POR EL METODO DE NEWTON RAPHSON Ingrese precisin de cifras significativas n= 6 Ingrese valor inicial xi= 1 Ingrese el valor de la gravedad g= 9.8 Ingrese el valor del coeficiente de arrate c= 14 Ingrese el tiempo t= 7 Ingrese el valor de la velocidad v= 35 El valor de la masa es: 63.649692228200834/nNumero de iteraciones: 5/n>>