SOR Method

Versione 1.0.0.0 (322 Byte) da Huy Ho
Input a square matrix. Decomposing the matrix into diagonal, lower and upper triangle matrix.
865 download
Aggiornato 21 mar 2018

Visualizza la licenza

function [x] = SOR_HW(A,b,x_0,omega)% Input a square matrix A, b, initial x and value of omega
format long;
N = 1000; %number of iteration
n = length(A);
tol = 0.0001;
x =zeros(n,1);
%Decomposing the Square matrix A into three matrices: diagonal matrix (D); strictly lower triangular matrix (L); strictly upper triangular matrix(U)
D = diag(diag(A));
L =-tril(A,-1);
U = -triu(A,1);
a = (D-omega*L);
for i=1:N
x = a\(((1-omega)*D + omega*U)*x_0) + omega*(a\b);
if norm(x-x_0)<tol
break;
end
x_0=x;
end
end

Cita come

Huy Ho (2025). SOR Method (https://it.mathworks.com/matlabcentral/fileexchange/66570-sor-method), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2017a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Linear Algebra in Help Center e MATLAB Answers
Tag Aggiungi tag

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0