필터 지우기
필터 지우기

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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by