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!
