cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Cumulative Function

mnesser
1-Newbie

Cumulative Function

I have a lengthy program that returns a row matrix (dN) as one of the results. What I need to do is to take the the value of the prior row and add it to the current row and iterate through the whole list. I get the result I need doing it manually, but the number of rows is variable (h) and large, +500.

Any help on a quick method to run this would be appreciated. My attempts at an i=0,1.. h soultion end up in a singular answer rather than the list of values I need.

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
AndyWesterman
4-Participant
(To:mnesser)

Is this what you need?

Regards

Andy

View solution in original post

5 REPLIES 5

Its not clear to me what you are trying to achieve.

Can you post a (short, manually derived) example and possible a worksheet (not necessarily that lengthy one you mentioned but soemthing stripped down to the point you are interested in).

What is given from the start and what is the supposed outcome?

Attached is an extract of the larger worksheet. (dN) is defined by a series of many other functions and variables.

The number of rows in (dN) is defined by the variable (h). I need a routine that takes the first row of dN then adds it to the next row, and repeats. Basically each new row should be the sum of all prior rows.

The result will be used to plot the accumulative damage (dN) as a function of (n) which is the number of rows.

AndyWesterman
4-Participant
(To:mnesser)

Is this what you need?

Regards

Andy

Exactly, thank you very much

OK, was a bit confused about the terminology - would call dN a column vector, not a row matrix.

I attach a routine which will work for column vectors as well as for matrices - the only difference is that the first row (index 0 by default ORIGIN) is missing in your example.

So I added a second routine which gets rid of that first value and works for vectors only.

Use whatever you need.

Cumulate1.png

Top Tags