Saturday, April 28, 2012

11.22

Write the following set of equations in matrix form:

50 = 5x_3 -7x_2
4x_2 + 7x_3 + 30 = 0
x_1 - 7x_3 = 40 - 3x_2 +5x_1

 Use excel, MATLAB, or Mathcad to solve for the unkowns. In addition,
 compute the transpose and the inverse of the coefficient matrix.

50 = 5x_3 -7x_2 + 0x_1
30 = - 7x_3 - 4x_2 + 0x_1
-40 =  7x_3 - 3x_2 +4x_1





Matlab Code:

A = [5 -7 0; -7 -4 0; 7 -3 4];
B = [50; 30; -40];
X = A\B;
%transpose
TransposeA = A.';
%inverse
inverseA = inv(A);

display(A)
display(B)
display(X)
display(TransposeA)
display(inverseA)

Results

A =

     5    -7     0
    -7    -4     0
     7    -3     4


B =

    50
    30
   -40


X =     

   -0.1449
   -7.2464
  -15.1812


TransposeA =

     5    -7     7
    -7    -4    -3
     0     0     4


inverseA =

    0.0580   -0.1014         0
   -0.1014   -0.0725         0
   -0.1775    0.1232    0.2500




X_1 = -0.1449
X_2 = -7.2464
X_3 = -15.1812

No comments:

Post a Comment