MATLAB ACTIVITY 4 - Determinant Using MATLAB: NAME: Gulla, Josiah Noel D. Section: CE21S2
MATLAB ACTIVITY 4 - Determinant Using MATLAB: NAME: Gulla, Josiah Noel D. Section: CE21S2
A. Use the det( ) built-in function to find the determinants of the following matrices. Write the MATLAB SYNTAX
you used and MATLAB out put on the space provided
−1 1 1
A=|−1 −1 1 |
1. 1 1 −1 det A = ____________
-1 1 1
-1 -1 1
1 1 -1
det(A) ans =
0
7 6 5 4
6 5 4 3
A=| |
5 4 3 2
2. 4 3 2 1 det A = ____________
A=[7 6 5 4; 6 5 4 3; 5 4 3 2; 4 3 2 1] A=
7 6 5 4
6 5 4 3
5 4 3 2
4 3 2 1
det(A) ans =
1 2 0
3.
B=3 (eye (¿( A¿)− A))
, where
B=Unrecognized function or variable 'B'
[ ]
A= 3 4 0
0 0 5 B= Matrix dimensions must agree. and det
A=[1 2 0; 3 4 0; 0 0 5] A=
1 2 0
3 4 0
0 0 5
3 4
0 1 1
5.
D= A AT
, where
[ ]
A= 0 1 0
1 0 1 D= [1 0 1; 0 2 1; 1 1 2] and det D=1
0 1 0
1 0 1
D=A'*A D=1 0 1
0 2 1
1 1 2
det(D) ans =1
B. By using Cramer’s Rule, determine the solution to the following systems of linear equations. Write the
MATLAB SYNTAX you used and MATLAB out put on the space provided
ïìï 2 x1 + 4 x2 + 6 x3 = 2
ïï
í x1 + 2 x3 = 0
ïï
ïïî 2 x1 + 3x2 - x3 = 5
MATLAB SYSNTAX MATLAB OUTPUT
X1=[2; 1; 2] X1 =
X2=[4; 0; 3] X2 =
X3=[6; 2; -1] X3 =
-1
b=[2; 0; 5] b=
5
A=[X1 X2 X3] A=
2 4 6
1 0 2
2 3 -1
B=det(A) B=
26
x1=det([b X2 X3])/B x1 =
14/13
x2=det([X1 b X3])/B x2 =
10/13
x3=det([X1 X2 b])/B x3 =
-7/13