How can I solve this matrix problem?

2 Ansichten (letzte 30 Tage)
Nguyen Vinh
Nguyen Vinh am 4 Jun. 2021
Beantwortet: Jonas am 4 Jun. 2021

Antworten (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 4 Jun. 2021
You can start working with eye() and rot90()
Then you can try with for loop, i.e. [for .. end] and [while .. end]
  1 Kommentar
Nguyen Vinh
Nguyen Vinh am 4 Jun. 2021
Unfortunately, my teacher doesn't allow me to use rot90()

Melden Sie sich an, um zu kommentieren.


Jonas
Jonas am 4 Jun. 2021
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.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by