Lab 2
Lab 2
Instructions
• Submit a Microsoft Word Report prepared as delineated in the Lab Report Guidelines
handout.
• The Appendix of the Report must include the MATLAB script files (.m file extension)
containing the codes/solutions to the problems presented in this assignment.
Problem 1
6 9 −4 −2
13 −8 −6 −1
𝐴=# /
−7 11 0 8
−14 1 −5 3
Next, the program should create the following four variables and matrix contents by extracting
and using the elements from the already created matrix A. An additional rule is that only one
single instance of A is allowed to be used for indexing, for every matrix created.
−2 6
11 0 −1 13
𝑊=1 2 𝑋=# /
1 −5 8 −7
3 −14
13 −8 −6 −6 −8 −1
𝑌=5 6 9 −46 𝑍 = 5 0 11 8 6
−14 1 −5 −5 1 3
All variables and contents should be displayed on the Command Window upon running the
program. No need to display any messages or properties.
Problem 2
The program should start by generating and displaying the same matrix A as in the previous
problem.
Afterwards, the program should create the following two variables and matrix contents by
extracting and using the elements from the already created matrix A. This time, you are allowed
to use multiple instances of A during indexing when creating the matrices, but you should make
sure to develop the most efficient code that uses the least amount of instances possible (do not
use more than necessary). Moreover, you should only use a single line of code to create each of
the matrices. Note that some rows and/or columns may need to be transposed.
9 −4 −2
−4 −2 −7
𝑀=1 2 𝑁 = 5 6 13 −76
−6 −1 −14
−6 0 −5
All variables and contents should be displayed on the Command Window upon running the
program. No need to display any messages or properties.