Documente Academic
Documente Profesional
Documente Cultură
METODO DE NEWTON-RAPHSON
REALIZANDO EN MATLAB:
clc
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
clear all
syms x
format short
f=(((2/((1/(10-((((5.67*(10^-8)/(-
272.15^4))*(x+17)*((x^2)+(17^2)))/(((0.92+(0.000591*20))^-1)+((4+0.9458544896-
1+(0.133*0.87))/0.87)-2)))))-(1/10)))^(1/(430*(1-(100/x)))))*(2+0.94))+17;
f1=diff(f,x); %Integra f con respecto a x
e=10^-5;
m=1;
d=1;
x1(m)=1-i;
while d>e
x=x1(m);
x1(m+1)=x1(m)-eval(f)/eval(f1);
d(m+1)=abs(x1(m+1)-x1(m));
m=m+1;
x=x1(m);
ft(m+1)=eval(f);
end
disp('********************************************************')
disp('****************METODO NEWTON-RAPHSON ******************');
disp('********************************************************')
disp(' i x d f(x)');
for p=1:m
fprintf('%2.0d %1d %2.7d %2.7d\n',p-
1,real(x1(p)),d(p),ft(p));
end
CORRIENDO EL PROGRAMA:
METODO MULLER
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
REALIZANDO EN MATLAB:
clc
clear all
format short
disp('********************************************************')
disp('*********************METODO MULLER**********************');
disp('********************************************************')
fprintf('\n');
syms t ;
m=1;
ed=1*10^-5;
ft=(((2/((520/t)*(((t-17)/(2+0.94585449))^(430*(1-(100/t))))))+(1/10))^-
1)+(((5.67*(10^-8)/((-272)^4))*(t+17)*((t^2)+(17^2)))/(((0.92+(0.000591*2*10))^-
1)+(((2*2)+0.94585449-1+(0.133*0.87))/0.87)-2));
d=1;
t1(m)=170;
t1(m+1)=170.5;
t1(m+2)=171.3;
e=10^-5;
t=t1(m);
f(m)=eval(ft);
t=t1(m+1);
f(m+1)=eval(ft);
t=t1(m+2);
f(m+2)=eval(ft);
fprintf('\n');
disp('========================================================')
disp(' i tw d f(tw) ');
disp('========================================================')
fprintf('%2.0d %2.7d %2.7d %2.7d\n',m-1,t1(m),d(m),f(m))
while e<d
t=t1(m);
f(m)=eval(ft);
t=t1(m+1);
f(m+1)=eval(ft);
t=t1(m+2);
f(m+2)=eval(ft);
h0=t1(m+1)-t1(m);
h1=t1(m+2)-t1(m+1);
d0=(f(m+1)-f(m))/h0;
d1=(f(m+2)-f(m+1))/h1;
a=(d1-d0)/(h1+h0);
b=a*h1+d1;
c=f(m+2);
t1(m+3)=t1(m+2)+(-2*c)/(b-sqrt(b^2-4*a*c));
d(m+1)=abs(t1(m+1)-t1(m));
m=m+1;
t=t1(m);
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
f(m)=eval(ft);
t=t1(m+1);
f(m+1)=eval(ft);
t=t1(m+2);
f(m+2)=eval(ft);
fprintf('%2.0f %2.7f %2.7f %2.7f\n',m-
1,t1(m),d(m),f(m))
end
disp('========================================================')
fprintf('La Raiz es %2.7f \n',t1(m))
corriendo el programa:
2. Tres productos químicos A, B y C tienen porcentajes de Hierro (Fe), Zinc (Zn) y Cobre (Cu).El
producto A tiene 50% de Fe, 30 de Zn y 20% de Cu. El producto B tiene 40% de Fe, 30% de Zn y
30% de Cu. Finalmente, el producto C tiene solo 30%de Fe y 70% de Zn. Determine cuantos mg
de cada producto debe combinarse para obtener un nuevo producto que contenga 44% de Fe,
38% de Zn y 18% de Cu, utilizando:
a. el método de eliminación Gauss-Jordan con pivoteo.
b. el método de Gauss-Seidel. E=1*10^-4
c. utilizando la inversa de la matriz coeficiente.
PA del Fe:56
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
PA del Zn:65
PA del Cu:64
Para el producto A:
end
x=A(:,n+1)./diag(A);
disp(' *************************************************')
fprintf('LAS RESPUESTAS SON:\n Fe=%fmg Zn=%fmg Cu=%fmg\n',x)
disp('**************************************************')
Corriendo el programa:
***********************************************************
********METODO DE ELIMINACION DE GAUSS-JORDAN CON PIVOTEO*********
***********************************************************
A=
B=
24640
24700
11520
A=
A=
A=
1.0e+04 *
A=
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
1.0e+04 *
2.8000 0 0 1.7135
0 0.3900 0.8960 0.4988
0 0 -8.5333 -4.6493
A=
1.0e+04 *
2.8000 0 0 1.7135
0 0.3900 0 0.0106
0 0 -8.5333 -4.6493
*************************************************
LAS RESPUESTAS SON:
Fe=0.611964mg Zn=0.027231mg Cu=0.544844mg
**************************************************
B. EL METODO DE GAUSS-SEIDEL.e=1*10^-4
Realizando el programa:
clc
clear all
format short
disp('***********************************************');
disp('****METODO DE ITERACION DE GAUSS - SEIDEL******');
disp('***********************************************');
A=[28000 19500 12800;22400 19500 19200;16800 45500 0]
b=[24640;24700;11520]
x0=zeros(1,3);
x=x0;
p=0;
D=1;
e=1*10^-4;
fprintf(' p Fe(mg) Zn(mg) Cu(mg) D\n')
disp('***********************************************');
while D >e
p=p+1;
fprintf('%2d',p);
for i=1:3
suma=0;
for j=1:3
if i~=j
suma=suma+A(i,j)*x(j);
end
end
x(i)=(b(i)-suma)/A(i,i);
fprintf('%11f',x(i))
end
D=norm(x0-x);
fprintf('%11f\n',D)
x0=x;
end
disp(' *************************************************')
fprintf('LAS RESPUESTAS SON:\n Fe=%fmg Zn=%fmg Cu=%fmg\n',x)
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
disp('**************************************************')
Corriendo el programa:
***********************************************
****METODO DE ITERACION DE GAUSS - SEIDEL******
***********************************************
A=
b=
24640
24700
11520
end
if i==1
l(3,2)=a(3,2)/a(2,2);
end
i=i+1;
end
l(2,1)=ab(2,1)/ab(1,1);
l(3,1)=ab(3,1)/ab(1,1);
u=a;
disp(u)
disp(l)
syms c1 c2 c3 x1 x2 x3
c=[c1;c2;c3];
x=[x1;x2;x3];
lc=l*c;
for i=1:n
fprintf('%2.3f=',b(i)), disp(lc(i))
end
fprintf('%5s\t','');disp('*********************************************')
fprintf('%5s\t','');disp('Resolviendo las tres ecuaciones obtenemos:')
fprintf('%5s\t','');disp('*********************************************')
fprintf('\n')
c1=b(1,1);
c2=(b(2,1)-l(2,1)*c1);
c3=b(3,1)-l(3,1)*c1-l(3,2)*c2;
c=[c1;c2;c3];
fprintf('c1=%2.3f\n',c(1))
fprintf('c2=%2.3f\n',c(2))
fprintf('c3=%2.3f\n',c(3))
ux=u*x;fprintf('\n')
for i=1:n
fprintf('%2.3f=',c(i)), disp(ux(i))
end
fprintf('%5s\t','');disp('*********************************************')
fprintf('%5s\t','');disp('Resolviendo las tres ecuaciones obtenemos:')
fprintf('%5s\t','');disp('*********************************************')
fprintf('\n')
x3=c(3,1)/u(3,3);
x2=(c(2,1)-u(2,3)*x3)/u(2,2);
x1=(c(1,1)-u(1,2)*x2-u(1,3)*x3)/u(1,1);
fprintf('Fe=%2.3f mg\n',x1)
fprintf('Zn=%2.3f mg\n',x2)
fprintf('Cu=%2.3f mg\n',x3)
Corriendo el programa:
*****************************************************************
*****************METODO INVERSA DE LA MATRIZ ******************
*****************************************************************
ab =
*********************************************
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.
1.0e+04 *
1.0000 0 0
0.8000 1.0000 0
0.6000 8.6667 1.0000
24640.000=c1
24700.000=(4*c1)/5 + c2
11520.000=(3*c1)/5 + (26*c2)/3 + c3
*********************************************
Resolviendo las tres ecuaciones obtenemos:
*********************************************
c1=24640.000
c2=4988.000
c3=-46493.333
4988.000=3900*x2 + 8960*x3
-46493.333=-(5864062014805333*x3)/68719476736
*********************************************
Resolviendo las tres ecuaciones obtenemos:
*********************************************
Fe=0.612 mg
Zn=0.027 mg
Cu=0.545 mg
UNIVERSIDAD NACIONAL DEL CENTRO DEL PERÚ
FACULTAD DE INGENIERIA QUIMICA
EAP: INGENIERIA QUIMICA INDUSTRIAL
ALUMNA: PAREDES QUISPE MARILIA MIRELLA.