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

Automate zaom hardcopy only points no submission-0 point 6 43 2 11 87 1) Create

ID: 1719706 • Letter: A

Question

Automate zaom hardcopy only points no submission-0 point 6 43 2 11 87 1) Create the following matrix M: 12 6 34 0 5 34 18 7 41 9 Use the matrix M to: a) Create a five element row vector named MatA that contains the elements of the second row of M. b) Create a three element row vector named MatB that contains the elements of the fourth column of M. c) Create a ten element row vector named MatC that contains the elements of the first and second rows of M. d) Create a six element row vector named MatD that contains the elements of the second and fifth columns of M. 2) Create these 3 arrays by using either commas or linspace: 1 2 3 4 5 5 6 7 8 9 5 11 17 23 29 35 9 10 11 12 13 B 27 24 21 18 15 12 13 14 15 16 17 55 60 65 70 75 80 17 18 19 20 21 21 22 23 24 25 c [49.5 49.1875 48.875 48.5625 48.25 47.9375 47.625 47.3 125 471 a) Replace the last 4 columns of the 1st and 4th rows of A with the last 4 columns of the 1st and 3rd rows of B. of A with the 2nd, 4th, 6th, 8th elements of c. b) Replace the first 4 columns of the 2nd row column of B. c) Replace the 2nd and 3rd rows of the last column of A with the last 2 rows of the 1st

Explanation / Answer

I assume that you work in Matlab. The code:

(a)

MatM = [6,43,2,11,87; 12,6,34,0,5; 34,18,7,41,9]

MatA = MatM(2,:)

MatB = MatM(:,4)'

MatC = [MatM(1,:),MatM(2,:)]

MatD = [MatM(:,2)',MatM(:,5)']

(b)

A = [linspace(1,5,5);linspace(5,9,5);linspace(9,13,5);linspace(13,17,5);linspace(17,21,5);linspace(21,25,5)]

B = [linspace(5,35,6);27:-3:12;55:5:80]

C = linspace(49.5,47,9)

A(1,2:5)=B(1,3:6)

A(4,2:5)=B(3,3:6)

A(2,1:4)=[C(2),C(4),C(6),C(8)]

A(2:3,5)=B(2:3,1)'