How can I store rotating index in a square matrix?

2 ビュー (過去 30 日間)
MathWorks Support Team
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
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 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by