What mean function diag and fliplr explain this two functions?

回答 (2 件)

Star Strider
Star Strider 2015 年 3 月 6 日

0 投票

If you are talking about my not yet Accepted Answer to your previous question, the diag function creates the diagonal matrices (see the documentation for details), and since the matrix you want is the mirror-image (enantiomer) of the one I created, I used fliplr to create the one you want.
My code from that Answer:
A = zeros(8);
for k1 = 4:7
A = A + diag(ones(1,8-k1),k1);
A = A + diag(ones(1,8-k1),-k1);
end
A = fliplr(A)
Reem Al Shehri
Reem Al Shehri 2015 年 3 月 6 日

0 投票

Thank you answers.

カテゴリ

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

質問済み:

2015 年 3 月 6 日

コメント済み:

2015 年 3 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by