How to formulate the summation of sequence number
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a sequence data between X and Y. In general Y is X summation
X Y
6.84 6.84
12.04 18.88
9.47 28.35
8.53 36.88
6.91 43.79
2.93 46.72
0.82 47.54
0.54 48.08
0 48.08
0 48.08
Y1=X1
Y2=X1+X2
Y2=X1+X2+X3
how to develop the function.
Thanks
3 commentaires
Réponse acceptée
Tommy
le 28 Mar 2020
Try
Y = cumsum(X)
3 commentaires
Walter Roberson
le 28 Mar 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/280160/Screenshot_20200327-231801_MATLAB.jpg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/280161/Screenshot_20200327-231809_MATLAB.jpg)
If agreement to within roundoff error is not good enough, then what do you require?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!