Create Block Toeplitz Matrix

How can I create a block toeplitz matrix with all zero elements apart from the main diagonal band?
If A and B are scalars the example below works
rng(123)
A = rand(3);
B = rand(3);
T=100;
Omega = toeplitz([A,B,zeros(T,3)]);

2 件のコメント

Jan
Jan 2021 年 5 月 4 日
編集済み: Jan 2021 年 5 月 4 日
A and B are not scalars in your example and if they are some, the last line fails also.
Please show us, which output you want to get.
Marco Lago
Marco Lago 2021 年 5 月 20 日
Sorry, my bad. With the scalar example I meant something like the example below. Which gives a squared toeplitz matrix like the folloqing but where A and B are, say, 3x3 matrices.
A B 0 ...0
B A B ...0
0 B A ...0
0 0 B ...0
: : : ....B
0 0 0 ...A
A =1;
B = 2;
T=100;
Omega = toeplitz([A;B;zeros(T,1)])

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

回答 (2 件)

Stephen23
Stephen23 2021 年 5 月 20 日
編集済み: Stephen23 2021 年 5 月 20 日

1 投票

C = {zeros(3),randi(9,3),randi(9,3)}; % {0,B,A}
N = 5;
X = toeplitz([3,2,ones(1,N-2)]);
M = cell2mat(C(X))
M = 15×15
5 5 9 4 9 7 0 0 0 0 0 0 0 0 0 8 2 3 4 9 7 0 0 0 0 0 0 0 0 0 9 2 3 2 1 9 0 0 0 0 0 0 0 0 0 4 9 7 5 5 9 4 9 7 0 0 0 0 0 0 4 9 7 8 2 3 4 9 7 0 0 0 0 0 0 2 1 9 9 2 3 2 1 9 0 0 0 0 0 0 0 0 0 4 9 7 5 5 9 4 9 7 0 0 0 0 0 0 4 9 7 8 2 3 4 9 7 0 0 0 0 0 0 2 1 9 9 2 3 2 1 9 0 0 0 0 0 0 0 0 0 4 9 7 5 5 9 4 9 7
Stephan
Stephan 2021 年 5 月 4 日

0 投票

Try:
rng(123)
A = eye(3);
B = randi(10,3);
Omega = kron(A,B)
gives:
Omega =
7 6 10 0 0 0 0 0 0
3 8 7 0 0 0 0 0 0
3 5 5 0 0 0 0 0 0
0 0 0 7 6 10 0 0 0
0 0 0 3 8 7 0 0 0
0 0 0 3 5 5 0 0 0
0 0 0 0 0 0 7 6 10
0 0 0 0 0 0 3 8 7
0 0 0 0 0 0 3 5 5

2 件のコメント

Marco Lago
Marco Lago 2021 年 5 月 4 日
but that will be a block diagonal matrix, not toeplitz
Stephan
Stephan 2021 年 5 月 4 日
編集済み: Stephan 2021 年 5 月 4 日
What is your desired output? Do you mean:
rng(123)
A = randi(10,1,4)
T=3;
Omega = toeplitz([A,zeros(1,T)]
Omega =
7 3 3 6 0 0 0
3 7 3 3 6 0 0
3 3 7 3 3 6 0
6 3 3 7 3 3 6
0 6 3 3 7 3 3
0 0 6 3 3 7 3
0 0 0 6 3 3 7

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

カテゴリ

ヘルプ センター および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

質問済み:

2021 年 5 月 3 日

編集済み:

2021 年 5 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by