How can I solve this matrix problem?

Risposte (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 4 Giu 2021

0 voti

You can start working with eye() and rot90()
Then you can try with for loop, i.e. [for .. end] and [while .. end]

1 Commento

Unfortunately, my teacher doesn't allow me to use rot90()

Accedi per commentare.

Jonas
Jonas il 4 Giu 2021

0 voti

Use a for-loop which goes from 1:n over the two dimensions, and use an if-statement to write a 1 and an else statement to write a 0, pending on if we comply with being on that diagonal.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Prodotti

Release

R2019a

Richiesto:

il 4 Giu 2021

Risposto:

il 4 Giu 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by