How can I store rotating index in a square matrix?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 12 Juil 2018
Réponse apportée : MathWorks Support Team
le 12 Juil 2018
For example, if I have index [1,2,3,4] how can I store it in a matrix such that each column represent these indices in rotation:
A = [1 2 3 4;
2 3 4 1;
3 4 1 2;
4 1 2 3];
Furthermore, the index I have is quite huge, which means A will can be a 1024 x 1024 in dimension.
Réponse acceptée
MathWorks Support Team
le 12 Juil 2018
You can use the "hankel" function to create such matrix in MATLAB:
>> v = 1:4;
>> A = hankel(v, circshift(v,1))
Furthermore, the matrix A above is actually a skew-circulant matrix, which is a special type of Hankel matrix. In real-life application, these matrices rarely need to be explicitly computed, as they can be applied via cross-correlations (and especially in the case of a skew-circulant matrix, this can be done quite efficiently with the FFT).
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!