Advertisement
STANAANDREY

sor

Mar 6th, 2023
1,368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.21 KB | None | 0 0
  1. function x = sor(A,b,x0,omega,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=(omega*L + D)^-1*((1-omega)*D*x-omega*U*x)+omega*(D+omega*L)^-1*b;
  8.     end
  9. end
  10.  
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement