Está en la página 1de 5

Taller 1.

Técnicas Computacionales
Gabriela Rios Giraldo- 2177625

a) Balance de materia
b) Resolviendo por método de eliminación de Gauss-Jordan
Código Gauss-Jordan (Matlab)

A=[ -6 0 1 0 0 ; 3 -3 0 0 0 ; 0 1 -9 0 0 ; 0 1 8 -11 2 ; 3 1 0 0 -4 ]
B= [-50 ; 0 ; -160 ; 0 ; 0 ]
X= inv(A)*B

Respuesta (concentraciones)

X =

11.5094
11.5094
19.0566
16.9983
11.5094

c) Criterio de convergencia (Jacobi - Gauss Seidel)


Resolviendo por método iterativo Gauss-Seidel

Código Gauss-Seidel (Matlab)

clc;clear all
A=[ -6 0 1 0 0 ; 3 -3 0 0 0 ; 0 1 -9 0 0 ; 0 1 8 -11 2 ; 3 1 0 0 -4 ];
b=[-50 ; 0 ; -160 ; 0 ; 0 ]';
x=[0 0 0 0 0 ]'
n=size(x,1);
normVal=Inf;
%%
% * _*Tolerence for method*_
tol=1e-5; itr=0;
%% Algorithm: Gauss Seidel Method
%%
while normVal>tol
x_old=x;
for i=1:n
sigma=0;
for j=1:i-1
sigma=sigma+A(i,j)*x(j);
end
for j=i+1:n
sigma=sigma+A(i,j)*x_old(j);
end
x(i)=(1/A(i,i))*(b(i)-sigma);
end
itr=itr+1;
normVal=norm(x_old-x);
end
%%
fprintf('Solution of the system is : \n%f\n%f\n%f\n%f in %d
iterations',x,itr);
x

Respuesta (concentraciones)

Solution of the system is :


11.509434
11.509434
19.056604
16.998285 in 1.150943e+01 iterationsSolution of the system is :
6.000000

x =
11.5094
11.5094
19.0566
16.9983
11.5094

d) Análisis de resultados

También podría gustarte