Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Cumulative sum along an axis

Christian Wild
Hi all,

I would like to calculate the cumulative sum in COMSOL without exporting data to Matlab. How can I achieve this ? Let's say my values are y(x) = [0,1,2,3,4,5] and I would like to get cumsum(y) = [0,1,3,6,10,15].

A push in the right direction would be highly appreciated :)

2 Replies Last Post Feb 27, 2017, 7:38 PM EST
Jeff Hiller COMSOL Employee
Posted: 10 months ago Feb 27, 2017, 8:27 AM EST
Hello Christian,
This blog, and in particular the section on the anti-derivative, should help:
www.comsol.com/blogs/overview-integration-methods-space-time/
Best,
Jeff
Hello Christian, This blog, and in particular the section on the anti-derivative, should help: https://www.comsol.com/blogs/overview-integration-methods-space-time/ Best, Jeff

Christian Wild
Posted: 9 months ago Feb 27, 2017, 7:38 PM EST
Hi Jeff,

many thanks, its a lot clearer now and I was able to implement it using the steps described in a follow-up blog post:

www.comsol.com/blogs/integrals-with-moving-limits-and-solving-integro-differential-equations/

Cheers,
Christian.
Hi Jeff, many thanks, its a lot clearer now and I was able to implement it using the steps described in a follow-up blog post: https://www.comsol.com/blogs/integrals-with-moving-limits-and-solving-integro-differential-equations/ Cheers, Christian.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.