0% found this document useful (0 votes)
3 views10 pages

Ad Math Lab 5

This document outlines Lesson 5 on mathematical operations in matrices, focusing on matrix equality, addition, subtraction, and scalar multiplication. It includes instructions for using MATLAB to perform matrix operations and create visualizations, along with specific tasks for students to complete. The lesson emphasizes the ease of handling matrices in MATLAB and provides examples of matrix creation, multiplication, and solving equations.

Uploaded by

Aouie Bulalacao
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)
3 views10 pages

Ad Math Lab 5

This document outlines Lesson 5 on mathematical operations in matrices, focusing on matrix equality, addition, subtraction, and scalar multiplication. It includes instructions for using MATLAB to perform matrix operations and create visualizations, along with specific tasks for students to complete. The lesson emphasizes the ease of handling matrices in MATLAB and provides examples of matrix creation, multiplication, and solving equations.

Uploaded by

Aouie Bulalacao
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/ 10

Name :Aouie S. Bulalacao Student No.

: 2058471
Course : BSECE 2nd Year Date : April 28,2025

LESSON 5: Mathematical Operations in a Matrix

Objectives: Perform different mathematical operations in a matrix & plot results from
matrix operations

Discussion: Two matrices are equal if and only if their corresponding elements are
equal. If Matrix A and Matrix C are two matrices of the same size, we can define their
sum by A + C and their difference by A - C. A scalar can be multiplied to a matrix by
multiplying every element of a matrix by the scalar. In multiplying matrix by another
matrix, the two matrices should be conformable. The number of columns of the first
matrix should be equal to the number of rows of the second matrix.

Instructions: Perform the following accordingly, then answer the questions that follow.
Place your answers on the space provided. Place the result of the following MATLAB
instructions on the space provided. The symbol “>>” indicates that you must show the
results in the space provided.

MATLAB Session

1. MATLAB is an abbreviation for "matrix laboratory." While other programming


languages mostly work with numbers one at a time, MATLAB® is designed to
operate primarily on whole matrices and arrays. All MATLAB variables are
multidimensional arrays, no matter what type of data. A matrix is a two-
dimensional array often used for linear algebra.
2. The following table provides a summary of arithmetic array operators in
MATLAB.

3. First, let us create a simple vector with 9 elements called a.

>> a = [1 2 3 4 6 4 3 4 5]

4. Now let us add 2 to each element of our vector, a, and store the result in a new
vector. Notice how MATLAB requires no special handling of vector or matrix
math.

>> b = a + 2

5. Creating graphs in MATLAB is as easy as one command. Let us plot the result of
our vector addition with grid lines.

>> plot(b)
>> grid on
6. MATLAB can make other graph types as well, with axis labels.

>> bar(b)
>> xlabel(‘ Sample # ’)
>> ylabel(‘ Pounds ’)

7. MATLAB can use symbols in plots as well. Here is an example using stars to
mark the points. MATLAB offers a variety of other symbols and line types.
>> plot(b, ‘*’)
>> axis([0 10 0 10 0])

8. In the previous activity, the demonstration of creating matrices was done. Create
two matrices.

>> A = [1 2 0; 2 5 -1; 4 10 -1]


>> B = A’

9. Now, let us multiply the two matrices. Note again that MATLAB does not require
you to deal with matrices as collection of numbers. MATLAB knows when you
are dealing with matrices and adjusts your calculations accordingly.

>> C = A * B

10. Let use the matrix A to solve the equation, A*x = b. we do this by using the \
(backslash) operator.

>> b = [1;3;5]
>> x = A\b

Now, we can show that A*x is equal to b.

>> r = A*x – b
11. MATLAB has functions for nearly every type of common matrix calculation. There
are functions to obtain eigenvalues as well as the singular values.

>> eig(A)

>> svd(A)

12. To represent the imaginary part of a complex number, use either i or j.

>> c = [3+4i, 4+3j; -i, 10j]


Activity
A. Use MATLAB to solve for the following. Given A & B:

1. A + B
2. B + A
3. A – B
4. B – A
5. 3A – 2B
6. 3(2A-B)
7. AT, BT
8. (A + B)T
9. A3 + 2A
10. BBT
B. Can multiplication occur
between the following
matrices? If so, compute it.
1.

2.
3.

4.

5.

You might also like