Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

3 Ansichten (letzte 30 Tage)
Ruten9
Ruten9 am 6 Dez. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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 Kommentar
Walter Roberson
Walter Roberson am 6 Dez. 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?

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by