Advertisement
STANAANDREY

gauss sedel

Mar 6th, 2023 (edited)
1,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.17 KB | None | 0 0
  1. function x = gauss_seidel(A, b, x0, k)
  2.     D=diag(diag(A));
  3.     L=tril(A)-D;
  4.     U=triu(A)-D;
  5.     x=x0;
  6.     for i=1:k
  7.         x=(D+L)^-1*(b-U*x);
  8.     end
  9. end
  10.  
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement