Guasselimination
Guasselimination
clc
clear all ;
%% creating a Matrix
A = input ( ' Enter the coefficient matrix ');
B = input ( ' Enter the constant matrix ');
N = length ( B ) ;
X = zeros ( N , 1 );
end
--------------------------------------------------------------------
OUTPUT
Enter the coefficient matrix [1 3 5 ; 3 2 4 ; 2 1 1 ]
Enter the constant matrix [ 2 ; 7 ; 4 ]
Aug =
X =
2.2500
-1.1250
0.6250
----------------------------------------------------------------------
SOLVER
>> A = [1 3 5 ; 3 2 4 ; 2 1 1 ];
>> B = [ 2 ; 7 ; 4 ] ;
>> X = inv ( A ) * ( B )
X =
2.2500
-1.1250
0.625