How can I solve this matrix problem?

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 4 日

0 投票

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

1 件のコメント

Nguyen Vinh
Nguyen Vinh 2021 年 6 月 4 日
Unfortunately, my teacher doesn't allow me to use rot90()

サインインしてコメントする。

Jonas
Jonas 2021 年 6 月 4 日

0 投票

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.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2019a

質問済み:

2021 年 6 月 4 日

回答済み:

2021 年 6 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by