You are on page 1of 3

Codigo

function [x,k]=jacobim(a,b,x,e,m)
n=length(x);
for k=1:m
t=x;
for i=1:n
s=a(i,1:i-1)*t(1:i-1)+a(i,i+1:n)*t(i+1:n);
x(i)=(b(i)-s)/a(i,i);
end
if norm((x-t),inf)<e
return
end
end
x=[];
k=m;
Matriz A:

ab ac bc bd cd ce de df ef eg fh fg gh gi
0.7999 0 0 0 0 0 0 0 0 0 0 0 0 0
0.6 1 0 0 0 0 0 0 0 0 0 0 0 0
- 0 -1 0.6 0 0 0 0 0 0 0 0 0 0
0.7999
-0.6 0 0 0.7999 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0.868 0 0 0 0 0 0 0 0 0
0 -1 0 0 0.4965 1 0 0 0 0 0 0 0 0
0 0 0 -0.6 -0.868 0 -1 0.2748 0 0 0 0 0 0
0 0 0 -0.7999 -0.4965 0 0 0.9615 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0.7894 0 0 0 0 0
0 0 0 0 0 -1 0 0 0.6139 1 0 0 0 0
0 0 0 0 0 0 0 -0.9615 -0.6139 0 1 0 0 0
0 0 0 0 0 0 0 -0.2748 -0.7894 0 0 -1 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0.932 0
0 0 0 0 0 0 0 0 0 -1 0 0 0.3624 1
Vector inicial

0
0
-40 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 Matriz b
0

>> A=xlsread('Matriz_A');

>> b=xlsread('Matriz_b');

>> x=xlsread('vector_inicial');
>> [x1,k]=jacobim(A,b,x,1e-8,100)

x1 =

-50.0063

30.0038

17.4944

-37.5094

-20.1548

40.0106

28.5648

-41.6127

-36.1855

62.2249

-62.2249

40.0000

-42.9185

77.7785

k=

11

You might also like