How can I solve this matrix problem?

Respuestas (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 4 de Jun. de 2021

0 votos

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

1 comentario

Nguyen Vinh
Nguyen Vinh el 4 de Jun. de 2021
Unfortunately, my teacher doesn't allow me to use rot90()

Iniciar sesión para comentar.

Jonas
Jonas el 4 de Jun. de 2021

0 votos

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.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Productos

Versión

R2019a

Preguntada:

el 4 de Jun. de 2021

Respondida:

el 4 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by