Page 144 - Numerical Analysis Using MATLAB and Excel
P. 144
Chapter 4 Matrices and Determinants
1 –
X = A B (4.53)
or
x 1 2 3 1 1 – 9
x 2 = 1 2 3 6 (4.54)
x 3 3 1 2 8
Next, we find the determinant detA , and the adjoint adjA .
1 – 5 7
detA = 18 and adjA = 7 1 – 5
– 5 71
Therefore,
1 – 5 7
1
1
A 1 – = ------------ adjA = ------ 7 1 – 5
detA 18
– 5 71
and by (4.53) we obtain the solution as follows.
x 1 1 – 5 7 9 35 35 18 1.94
⁄
1
1
X = x 2 = ------ 7 1 – 5 6 = ------ 29 = 29 18 = 1.61 (4.55)
⁄
18
18
⁄
x 3 – 5 71 8 5 518 0.28
To verify our results, we could use the MATLAB inv(A) function, and multiply A 1 – by . How-
B
ever, it is easier to use the matrix left division operation X = A \ B ; this is MATLAB’s solution of
1 –
X
B
A B for the matrix equation A X⋅ = B , where matrix is the same size as matrix . For this
example,
A=[2 3 1; 1 2 3; 3 1 2]; B=[9 6 8]'; X=A \ B % Observe that B is a column vector
X =
1.9444
1.6111
0.2778
As stated earlier, while MATLAB has the built−in function det(A) for computing the determi-
nant of a matrix A, this function is not included in the MATLAB Run−Time Function Library
List that is used with the Simulink Embedded MATLAB Function block. The MATLAB user−
defined function file below can be used to compute the determinant of a 2 × 2 matrix. A user-
defined function to compute the inverse of an n × n is presented in Chapter 14.
4−26 Numerical Analysis Using MATLAB® and Excel®, Third Edition
Copyright © Orchard Publications