How can I make this type of array.

3 ビュー (過去 30 日間)
RH
RH 2018 年 10 月 13 日
回答済み: the cyclist 2018 年 10 月 13 日
How can I copy the same array like the image ( It only adds another zero to the array) and combine them to make 2 rows?
yk=[0.0000;0.01953;0.07567;0.14890;0.22945;0.31001;0.39300;0.47111;
0.54922;0.62245;0.69324;0.76159;0.82750;0.89096;0.95199;1.00812;1.06427;1.11553;1.16435;1.21561;1.26199]
uk=ones(20,1)
  1 件のコメント
the cyclist
the cyclist 2018 年 10 月 13 日
Should be easy, but I don't quite understand what you want as output.
yk is a 21x1 array. uk is a 20x1 array.
Do you want your final array to be 21x4, or 20x4, or something else?

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

採用された回答

jonas
jonas 2018 年 10 月 13 日
編集済み: jonas 2018 年 10 月 13 日
horzcat(yk,[0;yk(1:end-1)])
ans =
0 0
0.019530000000000 0
0.075670000000000 0.019530000000000
0.148900000000000 0.075670000000000
0.229450000000000 0.148900000000000
...

その他の回答 (1 件)

the cyclist
the cyclist 2018 年 10 月 13 日
Pending an answer to the question in my comment, here is my best current guess as to what you want:
output = [yk, [0; yk(1:end-1)] uk [0; uk(1:end-1)]];
where I actually define
uk = ones(21,1);
instead of your 20x1 array.

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by