Series of vector values

1 次查看(过去 30 天)
I have a vector and I want another vector of the same lenght having as values the sequential sum of the values of the first vector. Basically I want a series from vector values. Ideas?

采纳的回答

Steven Lord
Steven Lord 2021-3-15
You want the cumulative sum?
x = 1:10
x = 1×10
1 2 3 4 5 6 7 8 9 10
y = cumsum(x)
y = 1×10
1 3 6 10 15 21 28 36 45 55

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by