How can i use toeplitz in cell arrays?

3 vues (au cours des 30 derniers jours)
Gn Gnk
Gn Gnk le 8 Déc 2020
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?

Réponses (2)

Stephan
Stephan le 8 Déc 2020
Modifié(e) : Stephan le 8 Déc 2020
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
  2 commentaires
Gn Gnk
Gn Gnk le 9 Déc 2020
Its cell contains 38x38 matrix . So its a 2D toeplitz. Not 1D.
Stephan
Stephan le 9 Déc 2020
Modifié(e) : Stephan le 9 Déc 2020
In my example I used 2x2 matrices to keep it simple and short. Don't you think this can be extended to 38x38?
G{1}
G{2}

Connectez-vous pour commenter.


Roee Ronkin
Roee Ronkin le 19 Avr 2023
cell2mat(G(toeplitz(1:numel(G))))

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by