Using a for loop to form a matrix (intermediate transformation matrix).

1 回表示 (過去 30 日間)
Mohammad Ayoub
Mohammad Ayoub 2018 年 4 月 23 日
コメント済み: KALYAN ACHARJYA 2018 年 4 月 23 日
Greetings.
Suppose that I have a dummy vector
dummy = [1764 1624 735 175 21];
I want to create the matrix W to be:
W = [1764 1624 735 175 21 1;1624 735 175 21 1 0;735 175 21 1 0 0;175 21 1 0 0 0;21 1 0 0 0 0;1 0 0 0 0 0]
Try that in MATLAB to see the form clearly. Can anyone help me create this code, but for a general form? dummy can be a vector of any length with any values. I am sorry if the question seems to be confusing but I cannot find a good way to describe it, you can ask me to make anything clear. Thank you in advance.

採用された回答

Matt J
Matt J 2018 年 4 月 23 日
編集済み: Matt J 2018 年 4 月 23 日
No for-loop needed,
W= hankel([dummy,1])
  2 件のコメント
Mohammad Ayoub
Mohammad Ayoub 2018 年 4 月 23 日
Thank you, I had no idea this function existed haha, that solves a lot of problems! Thank you so much.
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 4 月 23 日
Really Great. I was trying to solve your problem..haha

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by