Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Solve With MATLAB Create an m-file with the following array assignments and then

ID: 3819233 • Letter: S

Question

Solve With MATLAB

Create an m-file with the following array assignments and then write additional lines in your m-file to answer all the parts below.

a =

1             3             5             9

9             1             1             1

0             0             10           3

b =

1

1

9

c =

10           11           12           9

(a) Create a 3x1 array d that is the sum of vector b and the vector formed from the second column of a. The rules for matrix addition are here (Links to an external site.).

(b) Create a 1x4 array f that is the sum of c and the first row of a.

(c) Create a 3x4 array g, where the first element of b is added to every element in the first row of a, the second element of b is added to every element in the second row of a, and the third element of b is added to every element in the third row of a.

(d) Create a 1x7 array h, where the elements of b make up the first three elements of h and the elements of c make up the last four elements of h.

(e) Create 1x4 array k, where the elements are obtained from element-by-element multiplication of c and the first row of a.

(f) Create a 3x1 array n that is obtained from matrix multiplication of a and the transpose of c

Explanation / Answer

(a)
>> d=b+a(:,2)

d =

4
2
9

(b)
>> f=c+a(1,:)

f =

11 14 17 18

(c)
g= [b(1)+a(1,:);b(2)+a(2,:);b(3)+a(3,:)]

g =

2 4 6 10
10 2 2 2
9 9 19 12

(d)
>> h=[b' c]

h =

1 1 9 10 11 12 9


(e)
>> k=c.*a(1,:)

k =

10 33 60 81

(f)
>> n=[a(1,:)*c';a(2,:)*c';a(3,:)*c']

n =

184
122
147

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote