special sum of an array
    10 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Rica
 am 30 Jun. 2015
  
    
    
    
    
    Beantwortet: Sean de Wolski
      
      
 am 30 Jun. 2015
            hi all, is there any function to do this simply:
Array=[a1 a2 .......an]
i want to calculate this:
ArraySum=[a1  a1+a2  a1+a2+a3 .......a1+a2+a3+...an]
Thank you!
0 Kommentare
Akzeptierte Antwort
  Sean de Wolski
      
      
 am 30 Jun. 2015
        That's a cumulative sum, cumsum is the function you want:
a = [1 2 3]
cumsum(a)
ans =
   1     3     6
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Annotations finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
