Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Why do I keep getting an infinity loop when I try to implement the Jacobi method?

1 visualización (últimos 30 días)
I derived B from this linear system:
1a - 1b + 2c= 8
1a + 1b + 2c = 10
1a + 0b + 1c = 2
clear all;clc;
c=[8 10 2]';
B= [0 1 -2;-1 0 -2;-1 0 0];
tol = 10^(-10);
x0=[1,1,1]'; x(:,1)= x0;
k=1;
while 1
xnew(:,k+1) = (B*x(:,k)) + c;
if norm(xnew(:,k+1)-x(:,1)) < tol
break;
end
x=xnew;
k=k+1;
end
k
  1 comentario
Walter Roberson
Walter Roberson el 6 de Dic. de 2015
How the heck does your B array relate to the system of equations you indicate? And why are you adding c instead of subtracting it?

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by