How can I store rotating index in a square matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2018 年 7 月 12 日
回答済み: MathWorks Support Team
2018 年 7 月 12 日
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.
採用された回答
MathWorks Support Team
2018 年 7 月 12 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!