0% found this document useful (0 votes)
1K views9 pages

MATLAB ACTIVITY 4 - Determinant Using MATLAB

The document discusses using MATLAB to calculate determinants and solve problems using determinants. It provides 4 examples of using the det() function to find determinants of various matrices. It also provides 3 examples of using Cramer's Rule and determinants to solve systems of linear equations, find the volume of a tetrahedron, and calculate the area of a lot based on its vertex coordinates. Determinants and Cramer's Rule are applied to solve practical problems involving areas, volumes, and systems of equations.

Uploaded by

maski muz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views9 pages

MATLAB ACTIVITY 4 - Determinant Using MATLAB

The document discusses using MATLAB to calculate determinants and solve problems using determinants. It provides 4 examples of using the det() function to find determinants of various matrices. It also provides 3 examples of using Cramer's Rule and determinants to solve systems of linear equations, find the volume of a tetrahedron, and calculate the area of a lot based on its vertex coordinates. Determinants and Cramer's Rule are applied to solve practical problems involving areas, volumes, and systems of equations.

Uploaded by

maski muz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

MATLAB ACTIVITY 4 – Determinant Using MATLAB

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 = 0

Syntax:>> A=[-1 1 1;-1 -1 1;1 1 -1]

Output: A =
-1 1 1
-1 -1 1
1 1 -1
Syntax: A_ans=det(A)

Output: A_ans =

7 6 5 4
6 5 4 3
A=| |
5 4 3 2
2. 4 3 2 1 det A = 0

Syntax: >> A=[7 6 5 4;6 5 4 3;5 4 3 2;4 3 2 1]

Output: A =

7 6 5 4
6 5 4 3
5 4 3 2
4 3 2 1
Syntax: >> A_ans=det(A)

Output: A_ans =

1 2 0

3. If is
A= 3 4 0
0 0 5[ ] create a matrix B whose entries are three times the difference of an identity matrix of
order 3 and matrix A. What are the entries in B and its determinant?

Syntax: >> A=[1 2 0;3 4 0;0 0 5]; x=eye(3);


>> B=3*(x-A)
Output: B =

0 -6 0
-9 -9 0
0 0 -12

Syntax: >> B_ans=det(B)

Output: B_ans =

648

0 −6 0 1 1 1
Therefore B= −9 −9
0 [ ]
0 while the determinant of B=648. 1 −1 4
0 −12 2 3 −5 [ ]
A= 1 2
4.
^
Create matrix C if possible . Use C=5∗eye( size( A )− A ) 2 , where
[ ]
3 4 then matrix is C=
_____________ and determinant of C=_____

Syntax: >> A=[1 2;3 4];


>> C=5*eye(size(A)-A)^2

Output: Error using eye


N-dimensional arrays are not supported.

Syntax: >> C_ans=det(C)

Output: Unrecognized function or variable


'C'.

Therefore, matrix C cannot be solve for its determinant


since there is an error solving the matrix C.
0 1 1

5. D=transpose ( A )∗A , where


[ ]
A= 0 1 0
1 0 1 then D= _____________ and determinant of D=_____

Syntax: >> A=[0 1 1;0 1 0;1 0 1];

>> D=transpose(A)*A

Output: D =

1 0 1
0 2 1
1 1 2

Syntax: >> D_ans=det(D)

Output: D_ans =

1 0 1
Therefore D=
[ ]
0 2 1 while the determinant of D=1.
1 1 2

B. Use MATLAB SYNTAX solve the given problems below. Write the MATLAB syntax you use and the MATLAB
output in the space provided.

1. Use Cramer’s Rule to show the solution of


Arrange the following Linear Equation in the form of Ax + By = C:

8x + 12y = -24
7 5
x + y=−1
18 9

Syntax: >> CramerA=[8 12;7/18 5/9];CramerB=[-24;-1];


>> Ax=[-24 12;-1 5/9];Ay=[8 -24;7/18 -1];
>> Cramer_ans=det(CramerA)

Output: Cramer_ans =

-0.2222

Syntax: >> x=det(Ax)/Cramer_ans

Output: x =

6.0000

Syntax: >> y=det(Ay)/Cramer_ans

Output: y =

-6.0000

Therefore, SS = {6,-6}, x=6 and y=-6.


2. Find the volume of the given figure

1
Volume=± det
6

Syntax: >> Tetra=[60 0 0 1;0 60 0 1;0 0 60 1;0 0 0 1];


>> Tetravol=(1/6)*det(Tetra)

Output: Tetravol =

36000

Therefore, the volume of the given tetrahedron is equal to 36,000 cubic unit.
3. Mr. Cruz would like to buy a lot however, his broker gave the dimension of the lot using the vertices (0, 4), (0,-2) (20, 4) and
(10, -2). What would be the total area of the lot that Mr. Cruz will be buying?

Syntax: >> L1=[0 -2 1;10 -2 1;0 4 1]


Output: L1 =

0 -2 1
10 -2 1
0 4 1

Syntax: >> 1/2*(det(L1))

Output: ans =

30

Syntax:>> L2=[0 4 1;20 4 1;10 -2 1]

Output:>> L2 =

0 4 1
20 4 1
10 -2 1

Syntax: >> -1/2*(det(L2))


Output: ans =

60

Syntax:>>[1/2*(det(L1))+(-1/2*det(L2))]

Output:ans =

90

Therefore, the total area of lot that Mr. Cruz will buy will be 90 square meters.

“I affirm that I shall not give or receive any unauthorized help on this assignment and that all work is my own”

You might also like