Adding the arrays number
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hi to all, I have generated random numbers
a = 0
da = rand(1,10)
now i want to add a+da so that the previous result add to next rand no. for example
a = 0
da = 1 2 3 4
a_new = 0+1 = 1
in the next step
a_new = 1+2 =3
in the next step
a_new = 3+3 = 6
in the next step
a_new = 6+4 =10
etc
0 件のコメント
回答 (1 件)
Walter Roberson
2015 年 10 月 3 日
t = [a da];
t(1:end-1) + t(2:end)
2 件のコメント
Offroad Jeep
2015 年 10 月 3 日
編集済み: Offroad Jeep
2015 年 10 月 3 日
Walter Roberson
2015 年 10 月 3 日
a_new = cumsum(da);
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!