Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Why do I keep getting an infinity loop when I try to implement the Jacobi method?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Walter Roberson
il 6 Dic 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?
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!