Average of matrix element
1 view (last 30 days)
Show older comments
Supriya Gain
on 8 Aug 2019
Commented: Jos (10584)
on 8 Aug 2019
Suppose i have a 4X1 matrix like [a;b;c;d]. Now i want the output as [a;(a+b)/2;(a+b+c)/3;(a+b+c+d)/4].
How to do that?
1 Comment
Accepted Answer
More Answers (3)
madhan ravi
on 8 Aug 2019
cumsum(matrix)./(1:numel(matrix)) % where matrix is a column vector
0 Comments
See Also
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!