FA1.
2 (Matrices) 4Q2223
Name _Christian Adam B. Blasurca____________________ Date Posted _June 22 2023___
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 Columns 1 through 10
is 4, the last element is 37, with an increment of 3
between the elements. 4 7 10 13
16 19 22 25 28
31
Columns 11 through 12
34 37
2. Create the column vector named TWO with 8 equally -2 -4 -6 -8 -10
spaced elements in which the first element is -2 and the -12 -14 -16
last element is -16.
3. Create the following as indicated:
Given:
4 7 8 1 11
Q = [ 6 12 6 5 0]
−1 9 −4 −3 2
3.a) Create a five-element row vector named TRIA that contains TRIA =
the second row of the given.
6 12 6 5
0
3.b) Create a three-element row vector named TRIB that contains TRIB =
the fourth column of Q.
1
5
-3
4. Using the zeros, one and eye commands create the fourA=[zeros(2,5)]
following:
4.a)
0 0 0 0 0
𝑓𝑜𝑢𝑟𝐴 = [ ]
0 0 0 0 0
4.b) FourB=[eye(4)]
1 0 0 0
𝐹𝑜𝑢𝑟𝐵 = [0 1 0 0]
0 0 1 0
0 0 0 1
4.c) fourC=[ones(3,2)+ones(3,2)]
2 2
𝑓𝑜𝑢𝑟𝐶 = [2 2]
2 2
5. Solve the system of equations below by using the right x=1
division command. y=2
z=1
𝑥 − 3𝑦 + 4𝑧 = −1
{ 2𝑥 − 𝑦 + 3𝑧 = 3
4𝑥 + 𝑦 − 2𝑧 = 4
6. Given the following matrices:
2 9 − 3 2 2 6
1 2 3
5
8 1 6
4 4 1
A= C = 3 5 7
3
B=
6 7 5 4 − 1 2 0
4 9 2
2 − 1 − 2 3 6 1 1
6.a) Create a matrix named SIXA by evaluating (det(A))(B)(C).
1.0e+04 *
1.8700 2.7540
2.0060
1.5300 0.9520
1.5980
-0.0680 0.3060
0.2720
1.8700 0.6800
1.5300
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]. 1 0 0 0
Create an identity matrix with a size as matrix A named Seven. 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
O = [2, 2, –1; 3, –4, 0; 1, 3, 7].
8.a) Find MN and your surname as the name.
-8 -23
-32 16
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 A=rand(4,4)
line and show the output.
>> A=rand(4,4) A =
>> col1=A(:,1)
0.4218 0.6557
>> row2=A(2,:)
0.6787 0.6555
>> [sorted,i] = sort (col1) 0.9157 0.0357
>> sorted = col1(i) 0.7577 0.1712
0.7922 0.8491
Comments: 0.7431 0.7060
line 1 %... 0.9595 0.9340
line 2 %... 0.3922 0.0318
line 3 %...
line 4 %...
%...
col1=A(:,1)
col1 =
0.4218
0.9157
0.7922
0.9595
%...
row2=A(2,:)
row2 =
0.9157 0.0357
0.7577 0.1712
%...
[sorted,i] = sort (col1)
sorted =
0.4218
0.7922
0.9157
0.9595
i =
1
3
2
4
%...
sorted = col1(i)
sorted =
0.4218
0.7922
0.9157
0.9595
%...
B. From the command window, take a screenshot (per number ,CLEAR/READABLE) and paste
here for validation.