フィルターのクリア

How can i create this specific matrix??

1 回表示 (過去 30 日間)
연승 김
연승 김 2021 年 9 月 9 日
コメント済み: 연승 김 2021 年 9 月 9 日
Hello. I'm MATLAB beginner.
I want to make A matrix like below.
ex1)
i = 2
j = 3
A = [1,1,0,0,0,0 ; 0,0,1,1,0,0 ; 0,0,0,0,1,1]
ex2)
i = 2
j = 2
A = [1,1,0,0 ; 0,0,1,1]
ex3)
i = 3
j = 4
A = [1,1,1,0,0,0,0,0,0,0,0,0 ; 0,0,0,1,1,1,0,0,0,0,0,0 ; 0,0,0,0,0,0,1,1,1,0,0,0 ; 0,0,0,0,0,0,0,0,0,1,1,1]
Could you MATLAB masters please help me??

採用された回答

Chunru
Chunru 2021 年 9 月 9 日
i=3;
j=4;
A = kron(eye(j), ones(1,i))
A = 4×12
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
  1 件のコメント
연승 김
연승 김 2021 年 9 月 9 日
wow. it works well!!
you are genius..!!!
Funcicton 'kron' is good^^

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

その他の回答 (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