I’m thinking of make a command to change Hankel matrix into x time series

2 ビュー (過去 30 日間)
Ahmed
Ahmed 2023 年 6 月 29 日
編集済み: David Goodmanson 2023 年 6 月 30 日
    y =
      [17    24     1     8    15
      23     5     7    14    16
       4     6    13    20    22
      10    12    19    21     3
      11    18    25     2     9] my question how could  I use function to be x =  [17 ,24,5,7,13,20,21,3,9].
  1 件のコメント
Shantanu Dixit
Shantanu Dixit 2023 年 6 月 29 日
Could you please elaborate, it's a bit unclear what you're asking. Thanks

サインインしてコメントする。

回答 (1 件)

David Goodmanson
David Goodmanson 2023 年 6 月 29 日
編集済み: David Goodmanson 2023 年 6 月 30 日
Hi Ahmed,
here is one way
y = magic(5)
n = size(y,2);
x = zeros(1,2*n-1);
x(1:2:end) = diag(y).';
x(2:2:end) = diag(y,1).'
  2 件のコメント
Ahmed
Ahmed 2023 年 6 月 29 日
編集済み: Ahmed 2023 年 6 月 29 日
it did not work
Unable to perform assignment because the left and right sides have a different number of elements.
I have n * m matrix 5000*3000
i want to have x of time series from hankel matrix
David Goodmanson
David Goodmanson 2023 年 6 月 29 日
編集済み: David Goodmanson 2023 年 6 月 30 日
Hi Ahmed,
your example was a square matrix. I changed the code in the answer so it works when there are more rows than columns, such as 5000x3000. Except in that case, at row 3000 the pattern will hit column 3000 at the right hand side of the matrix. This leaves a 2000x3000 matrix at the bottom that is not being sampled from. Is anythng supposed to happen then?

サインインしてコメントする。

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by