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

MATLAB Create a matrix with 4 rows and 8 columns with every element equal to 0.

ID: 670597 • Letter: M

Question

MATLAB

Create a matrix with 4 rows and 8 columns with every element equal to 0. Create a second, smaller matrix with 2 rows and 4 columns where each row is [1 2 3 4]. Replace the 0s in the upper left-hand corner of the bigger matrix with the values from the smaller matrix. (If you do this correctly, the first 4 columns of the first 2 rows of the big matrix will change.) Display the modified big matrix.

y=zeros(4,8)

z=meshgrid(2,4)

thats my code so far but i need the code for merging the small matrix into the bigger one

Explanation / Answer

0 0 0 0 0 0 0 0
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

B= 1 2 3 4
   1 2 3 4

Modified A =

1 2 3 4 0 0 0 0
   1 2 3 4 0 0 0 0
   0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0