Info
This question is closed. Reopen it to edit or answer.
Why do I keep getting an infinity loop when I try to implement the Jacobi method?
1 view (last 30 days)
Show older comments
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 Comment
Walter Roberson
on 6 Dec 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?
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!