You are on page 1of 30

DON HONORIO VENTURA STATE UNIVERSITY

College of Engineering and Architecture

Mechanical Engineering Department

CONTROL ENGINEERING

LABORATORY MANUAL

Experiment 2

BASIC Matrix Operations Using MATLAB

STUDENT NAME: BONDOC, OWEN ANDREI Q.

SECTION: BSME-3B

INSTRUCTOR: ENGR. ANTHONY TOLENTINO

DATE SUBMITTED: NOVEMBER 12, 2021

1|Page
I. OBJECTIVES

The objective of the experiment is to learn the basic knowledge


of matrix and to understand the importance of Matlab in solving matrix
as stated below:

 To learn the definition of matrix and its different types


 To know the different operations and techniques in solving
matrices
 To solve matrices manually and using the application Matlab
 To differentiate the manual solving and Matlab application

II. PROCEDURE
Solving matrices manually
1. The first step is to solve the given matrices on the board with
the operations indicated such as addition, subtraction,
multiplication, transpose and determinants. Division is not
applicable in solving matrices. In solving the given matrices, you
need to use the manual method of solving.
 Addition and subtraction of matrices
 In addition and subtraction of matrices, you can only
add or subtract square matrices which has equal number
of rows and columns.
 The element in the same row and column of two matrices
are the ones you add or subtract.
 The sum and difference of the two matrices will have the
same number of rows and columns with the two matrices
given.
 Multiplication of matrices
 You can only perform the multiplication in matrices if the
number of column of the first matrix should be equal to
the number of rows of the second matrix.
 In multiplying, you have to multiply the first row of the
first matrix with first column of the second matrix and so
on.
Example:
A = -1 4 B=2 4
2 5 -3 6
A*B = (-1)(2) + (4)(-3) (-1)(4) + (4)(6)
(2)(2) + (5)(-3) (2)(4) + (5)(6)
= -14 20
-11 38
 The product will have the orientation of the number of
rows of the first matrix and the number of columns of
the second matrix
 Transpose
 In transposing matrices, the number of columns of the
first matrix should be equal to the number of rows of the
second matrix. Only then, you can perform the said
operation
 You only need to change the orientation of the elements.
Put all the elements of the first row in the first column and
same goes with the other elements.
 Determinants
 In determining the determinants, you have to choose
a certain row or column.
 Find all its minor and cross multiply them. Each product
should be subtracted and multiply by the corresponding
elements on the row or column you choose with its minor.
 Then, add and subtract all the product. If choose the first
row, then the first operation to be used is subtraction
then addition. It depends on how many elements is in the
first row.
 The sum or difference will be the determinant of the
matrix.

Solving matrices in Matlab

1. Open the application Matlab.


2. Type in the variables with its corresponding values using
vectors. Vectors are made up of columns and rows that is
separated by a semi-colon.
3. Perform and type in the given operation with each variable.
 Addition, subtraction and multiplication of matrices

 Type in a variable (z) that is still not used and put an


equal sign after it.
 Type the first variable (a) which has its corresponding
value and put the operation indicated. If addition, put a
plus sign. If subtraction, put a minus sign. If
multiplication, put an asterisk.
 After the sign, type the other variable.
 Press enter. The command window will show you the sum,
difference and product of the matrices in vector form.

 Transpose
 Type in the variable (x) that is still not used and put an
equal sign after it.
 Type “transpose” and put and open parenthesis after it.
 After the open parenthesis, type the variable (a) which has
a corresponding value and close it using a close
parenthesis.
 Press enter. The command window will show you the
transpose value of the variable (a) in vector form.

 Determinants
 Type in the variable (x) that is still not used and put
an equal sign after it.
 Type “det” and put and open parenthesis after it.
 After the open parenthesis, type the variable (a) which has
a corresponding value and close it using a close
parenthesis.
 Press enter. The command window will show you the
determinant value of the variable (a) in vector form.

 Matrix Inverse
 Type in the variable (x) that is still not used and put an
equal sign after it.
 Type “inv” and put and open parenthesis after it.
 After the open parenthesis, type the variable (a) which has
a corresponding value and close it using a close
parenthesis.
 Press enter. The command window will show you the
determinant value of the variable (a) in vector form.
III. DATA AND RESULT

Part 1: Addition, Subtraction, Multiplication with a Scalar, and


Multiplication of Matrices
Part 2: Transpose
Part 3: Determinants
Part 4: Inverse
IV. ANALYSIS
AND CONCLUSION

Solving the exercises are much easier by using and following the
instructions on matlab.

You might also like