Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

FA1.

2 (Matrices) 3Q2324

Name __________MARQ LLONARD Z. SUAREZ___________ Date Posted ___03/05/2024___

Evaluate the following using MATLAB. Observe the correct syntax.


[In your command window, always start with the problem number with your surname ]
A. Perform as indicated.

Syntax Results
1. Create a row vector named ONE in which the first element is -2, ONE =
the last element is 26, with an increment of 4 between the
elements. -2 2 6
10 14 18
22 26

2. Create the column vector named TWO with 8 equally spaced TWO =
elements in which the first element is -4 and the last element is
14. -4.0000 -
1.4286 1.1429
3.7143 6.2857
8.8571 11.4286
14.0000

3. Create the following as indicated: TRIA =


Given:
4 9 8 1 11 6 -2 6
R = [ 6 −2 6 5 0] 5 0
−1 5 −4 −3 2
3.a) Create a five-element row vector named TRIA that contains the second
row of the given.
3.b) Create a three-element row vector named TRIB that contains the TRIB =
second column of R.
9
-2
5

4. Using the zeros, one and eye commands create the following: fourA =
4.a)
0 0 0 0 0 0 0 0 0
𝑓𝑜𝑢𝑟𝐴 = [ ] 0 0 0
0 0 0 0 0 0
0 0 0
0 0 0

4.b) FourB =
1 0 0 0
1 0 0
𝐹𝑜𝑢𝑟𝐵 = [0 1 0 0]
0 0 1 0 0
0 0 0 1 0 1 0
0
0 0 1
0
0 0 0
1

4.c) fourC =

5 5 5 5
𝑓𝑜𝑢𝑟𝐶 = [5 5] 5 5
5 5 5 5

5. Solve the system of equations below by using the right division xSol =
command.
1
𝑥 − 3𝑦 + 4𝑧 = −1 ySol =
{ 2𝑥 − 𝑦 + 3𝑧 = 3
4𝑥 + 𝑦 − 2𝑧 = 4 2
zSol =

6. Given the following matrices: SIXA =

2 9 − 3 2 1.0e+04 *
2 5 6 8 1 6
1 2 3 4 4 1
A= C = 3 5 7 
 3 1.8700
B=
6 7 5 4 − 1 2 0 2.7540 2.0060
    4 9 2
2 − 1 − 2 3 6 1 1 1.5300
0.9520 1.5980
-0.0680
6.a) Create a matrix named SIXA by evaluating (det(A))(B)(C).
0.3060 0.2720
1.8700
0.6800 1.5300

SIX =
6.b) Create a matrix named SIX by evaluating (A-1)(AT)(B).
4.7324
37.0559 28.1353
-5.5500 -
32.0500 -27.7000
-9.9559 -
43.5147 -37.0882
12.3088
55.3971 48.3824
7. Let A = [1, –10, 6, 4; 7, 2, 5, –11; 12, 0, 0, –8; 1, 3, 5, 6].
Create an identity matrix with a size as matrix A named Seven.
Seven =

1 0 0
0
0 1 0
0
0 0 1
0
0 0 0
1

8. Let M = [1, 3, 6; –2, 4, 0; –5, –8, 9], N = [4, –2; –6, 3; 1, –5] and SUAREZ =
O = [2, 2, –1; 3, –4, 0; 1, 3, 7].
-8 -23
-32 16
8.a) Find MN and your surname as the name.
37 -59

8.b) Show that M/O = MO-1 div =

0.1171 -
0.0360 0.8739
0.2523 -
0.8468 0.0360
-3.8288
0.6396 0.7387
mul =

0.1171 -
0.0360 0.8739
0.2523 -
0.8468 0.0360
-3.8288
0.6396 0.7387

9. Given the sample programming, analyze/write a comment per line and A =


show the output.
>> A=rand(4,4) 0.8147
0.6324 0.9575
>> col1=A(:,1)
0.9572
>> row2=A(2,:) 0.9058
>> [sorted, i] = sort (col1) 0.0975 0.9649
>> sorted = col1(i) 0.4854
0.1270
Comments: 0.2785 0.1576
line 1 %... 0.8003
line 2 %... 0.9134
line 3 %... 0.5469 0.9706
0.1419
line 4 %...
col1 =

0.8147
0.9058
0.1270
0.9134

row2 =

0.9058
0.0975 0.9649
0.4854

sorted =

0.1270
0.8147
0.9058
0.9134

i =

3
1
2
4
sorted =

0.1270
0.8147
0.9058
0.9134
6 -2 6 5
0

B. From the command window, take a screenshot (per number ,CLEAR/READABLE) and paste
here for validation.

You might also like