Average of matrix element
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Supriya Gain
il 8 Ago 2019
Commentato: Jos (10584)
il 8 Ago 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 Commento
Risposta accettata
Più risposte (3)
madhan ravi
il 8 Ago 2019
cumsum(matrix)./(1:numel(matrix)) % where matrix is a column vector
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!