Create a block diagonal, Toeplitz and triangular matrix given by n,B,C,A

Hello everyone,
Im trying to create an mn x mn matrix using m x m matrices. For example:
A = [1 2; 3 4]
B=[9 10; 11 12]
C = [ 5 6; 7 8]
n = 3
Should give me this answer: Attached image.

댓글 수: 4

Image Analyst
Image Analyst 2021년 11월 28일
편집: Image Analyst 2021년 11월 28일
I'm not going to delete John's question since he took his valuable time to donate to you. It would be rude to him to delete his post or the question that he answered.
You say this one is a duplicate question but if so, you deleted that one since this is the only question you've posted (and may well be the last one that anyone ever wants to answer). Please, as a courtesy to John, restore this one.
The original question had an image attached, but here is the text:
Create a block diagonal, Toeplitz and triangular matrix given by n,B,C,A
Hello everyone,
Im trying to create an mn x mn matrix using m x m matrices. For example:
A = [1 2; 3 4]
B=[9 10; 11 12]
C = [ 5 6; 7 8]
n = 3
Should give me this answer: Attached image.
Im sorry i restored the question..
Thanks my fault.
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2021년 11월 28일
편집: John D'Errico 2021년 11월 28일
The simplest answer is to use my blktridiag utility from the file exchange.
full(blktridiag(A,C,B,3))
ans =
1 2 9 10 0 0
3 4 11 12 0 0
5 6 1 2 9 10
7 8 3 4 11 12
0 0 5 6 1 2
0 0 7 8 3 4
By default, it produces a sparse matrix. Since you did not ask for that, I put a call to full around it.
Of course, if this is homework, then my answer is useless. If it is not, then my answer is the perfect solution. Find blktridiag on the File Exchange at this link:
Could you solve it using blkdiag? Well, yes, if this is your homework, with some effort. In that case, you you create the main diagonal of matrices from A? How might you do that? Perhaps that is a sufficient hint to get you started, IF this is your homework. Better is to just use code designed to solve your problem, efficient, already written and debugged.

카테고리

도움말 센터File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

질문:

2021년 11월 28일

댓글:

2021년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by