How can I solve this matrix problem?

Antworten (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 4 Jun. 2021

0 Stimmen

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

0 Stimmen

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 Hilfe-Center und File Exchange

Produkte

Version

R2019a

Gefragt:

am 4 Jun. 2021

Beantwortet:

am 4 Jun. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by