Creation of matrices (24,72) M1&M2 ?

10 ビュー (過去 30 日間)
ET-TAOUSSI mehdi
ET-TAOUSSI mehdi 2016 年 2 月 2 日
コメント済み: Stephen23 2016 年 2 月 3 日
Hello. I want to create matrices (24,72) that have the following forms:

採用された回答

Stephen23
Stephen23 2016 年 2 月 2 日
編集済み: Stephen23 2016 年 2 月 3 日
You can use blkdiag:
C1 = repmat({[1,1,0]},1,24);
M1 = blkdiag(C1{:});
And the second is either:
M2 = circshift(M1,[0,1]);
or
C2 = repmat({[0,1,1]},1,24);
M2 = blkdiag(C2{:});
  2 件のコメント
ET-TAOUSSI mehdi
ET-TAOUSSI mehdi 2016 年 2 月 2 日
Thank you Stephen Cobeldick
Stephen23
Stephen23 2016 年 2 月 3 日
Another simple method is to use eye, zeros and reshape:
M1 = reshape([eye(24);eye(24);zeros(24)],24,72);
M2 = reshape([zeros(24);eye(24);eye(24)],24,72);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by