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

Matlab code: [ 17 24 1 8 5] | 23 5 7 14 16| Let z=|4 6 13 20 22| |10 12 19 21 3|

ID: 3679351 • Letter: M

Question


Matlab code:


          [ 17 24 1    8     5]
          | 23 5    7 14 16|
Let z=|4     6   13 20   22|
           |10 12 19 21     3|
           [11 18   25 2     9]


Perform the following operations to in the order given:

a)Divide column 2 by sqrt(3)
b.)
Add the elements of the third row to the elements in the fifth row (the third row remains unchanged
c.) Multiply the elements of the first column by the corresponding elements of the fourth column and place the result in the first column.
d.)
Set the diagonal elements to 2.
e.) Print the matrix z either row-wise or column-wise

Explanation / Answer

z=[17 24 1 8 5; 23 5 7 14 16; 4 6 13 20 22; 10 12 19 21 3; 11 18 25 2 9];
(a). z(:,2)=z(:,2)/sqrt(3);
(b). z(5,:)=z(5,:)+z(3,:);
(c). z(:,1)=z(:,1).*z(:,4);
(d). z(1:5+1:5*5) = 2;
(e). row-wise   

disp(z);

column-wise

disp(z');