Question: Create a 10x10 matrix in MATLAB that contains only zeros and ask the user to enter the first 2 values and the last 2 values

Create a 10x10 matrix in MATLAB that contains only zeros and ask the user to enter the first 2 values and the last 2 values of the matrix so the result is like that shown in the following image:

5 5 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 3 3

The user should be able to enter the values of 5 and 3 (or any two integer values) for the first and last two positions in the matrix. DO NOT hardcode the pattern. Hint: begin with matrix=zeros(R,C)

Next, create the following matrix, but DO NOT hardcode the repetitive pattern; YOU MUST use a looping structure and have the repetitive pattern automatically displayed back to the user so they can see how the loop progresses:

5 5 0 0 0 0 0 0 0 0
10 11 12 0 0 0 0 0 0 0
0 10 11 12 0 0 0 0 0 0
0 0 10 11 12 0 0 0 0 0
0 0 0 10 11 12 0 0 0 0
0 0 0 0 10 11 12 0 0 0
0 0 0 0 0 10 11 12 0 0
0 0 0 0 0 0 10 11 12 0
0 0 0 0 0 0 0 10 11 12
0 0 0 0 0 0 0 0 3 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!