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

Take two inputs from the user and build following square-matrix Example run: Siz

ID: 3565105 • Letter: T

Question

Take two inputs from the user and build following square-matrix                                             

Example run:

Size of the square-matrix: 11

Cutting factor: 8

Output:

Does anyone know how to go about making a script on how to solve this? I've tried but I haven't been able to get this. An explanation would be most appreciated. Thank you.

Take two inputs from the user and build following square-matrix Example run: Size of the square-matrix: 11 Cutting factor: 8 Output: Does anyone know how to go about making a script on how to solve this? I've tried but I haven't been able to get this. An explanation would be most appreciated. Thank you.

Explanation / Answer

%Take two inputs from the user and build following square-matrix                                           
row = input('Size of the square-matrix: ');
fact = input('Cutting factor: ');
mat = [];
for i=1:row
for j=1:row
       if i+j <= (fact+1)
       mat(i,j) = 0;
       else
       mat(i,j) = 1;
       end
   end
end

mat

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