Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Adding the arrays number

1 Ansicht (letzte 30 Tage)
Offroad Jeep
Offroad Jeep am 3 Okt. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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

Antworten (1)

Walter Roberson
Walter Roberson am 3 Okt. 2015
t = [a da];
t(1:end-1) + t(2:end)
  2 Kommentare
Offroad Jeep
Offroad Jeep am 3 Okt. 2015
Bearbeitet: Offroad Jeep am 3 Okt. 2015
kindly see the question ..... your answer is not working......... kindly check it thanks...........
Walter Roberson
Walter Roberson am 3 Okt. 2015
a_new = cumsum(da);

Community Treasure Hunt

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

Start Hunting!

Translated by