How can i use toeplitz in cell arrays?
3 次查看(过去 30 天)
显示 更早的评论
Hello ,
i have 1x38 cell matrix and every cell contains a 38x38 matrix .I want to perform toeplitz() on this cell array but matlab cannot do that .
For example if my cell array is G then i want to create this toeplitz matrix :
G_toeplitz = [G{1} 0 0 0
G{2} G{1} 0 0
G{3} G{2} G{1} 0
G{4} G{3} G{2} G{1} .......
.
.
.
]
Is there any way to do this?
0 个评论
回答(2 个)
Stephan
2020-12-8
编辑:Stephan
2020-12-8
G = cell(1,2);
G{1} = ones(2);
G{2} = 2*ones(2);
c = [G{1} G{2}];
r = [G{1} zeros(2)];
result = toeplitz(c,r)
results in:
result =
1 1 1 1 0 0 0 0
1 1 1 1 1 0 0 0
1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 0
2 1 1 1 1 1 1 1
2 2 1 1 1 1 1 1
2 2 2 1 1 1 1 1
2 2 2 2 1 1 1 1
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!