How to write pentadigonal matix?
이전 댓글 표시
How to generate the following penta diagonal matrix in matlab?

채택된 답변
추가 답변 (1개)
Bruno Luong
2020년 7월 27일
편집: Bruno Luong
2020년 7월 27일
m = 4;
n = 3*m;
T = diag(ones(1,n-3),3);
A = T + T';
B = ones(3)-5*eye(3);
A = A + kron(eye(m),B)
댓글 수: 1
Bruno Luong
2020년 7월 27일
편집: Bruno Luong
2020년 7월 27일
If you insist on for loop
m = 4;
n = 3*m;
T = diag(ones(1,n-3),3);
A = T + T';
B = ones(3)-5*eye(3);
for k=1:m
i = (k-1)*3+(1:3);
A(i,i) = B;
end
A
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
