Aggiunto metodi di fattorizzazione di matrice

This commit is contained in:
2014-10-15 15:38:30 +02:00
parent 660d633b37
commit 6b30e9e8cb
2 changed files with 32 additions and 1 deletions

31
samples/LU.m Normal file
View File

@@ -0,0 +1,31 @@
%se A <EFBFBD> la matrice originale
% e A1 la matrice dopo la riduzione di gauss naif
% allora A = L * U
L=tril(A1,-1) + eye (size(A1));
U=triu(A1);
A = L * U;
%se A <EFBFBD> la matrice originale
% e A1 la matrice dopo la riduzione di gauss pivot
% allora P A = L * U
L=tril(A1,-1) + eye (size(A1));
U=triu(A1);
% P matrice di permutazione in base al pivot
P * A = L * U;
%comando matlab per fattorizzare A
[L,U,P] = lu(A);

View File

@@ -6,6 +6,6 @@
U=[2,4,-2;1,-1,5;4,1,-2] % matrice di input U=[2,4,-2;1,-1,5;4,1,-2] % matrice di input
b=[6;-3;-10] %termini noti b=[6;-3;-10] %termini noti
[x,y,z] = convert_matrix_to_triangular_matrix_gauss_pivoting(U,b) [x,y] = convert_matrix_to_triangular_matrix_gauss_naif(U,b)
[x1] = linear_system_resolver_triangular_matrix(x,y) [x1] = linear_system_resolver_triangular_matrix(x,y)