Sum function

Have a suggestion for improving DPlot or a question about existing features? Let us know

Moderator: DPlotAdmin

Post Reply
jsc
Posts: 222
Joined: Fri Dec 02, 2005 8:56 am

Sum function

Post by jsc »

I'm having a little trouble understanding where and how this function could be used.

I'd love to do this: sum(if(Y1>600,1,0))

and have DPlot immediately calculated a running total of equation at each point dX. But that is not allowed.

I first have to build the curve, then sum it. Or from the menu, I could integrate the curve in this case. Both generate an additional curve, and I'm trying to stay under that 9 curve limit for being able to do calculations on curves.

Any ideas? (Am I doing this all wrong?)
jsc
Posts: 222
Joined: Fri Dec 02, 2005 8:56 am

Post by jsc »

David, I'd still like to do something like SUM("insert function") and not waste a curve. Or have more than 1-9 to work with for the number of curves. Something like 0-9 plus "A-F" perhaps. (or some other digit or symbol?). Any chance?? Thanks again.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

There's a "Running Total" command on the Generate menu that will do (as far as I can tell) what you want. You can run this from a macro with
RunPlugin("Running Total")
Visualize Your Data
support@dplot.com
jsc
Posts: 222
Joined: Fri Dec 02, 2005 8:56 am

Post by jsc »

You must mean "Integrate a Curve". (There's no other "running total" command in 2.3.5.3??) Yes, I saw that, but didn't try it because I thought it acted "odd" the last time I played with it. But now I see it actually does do a SUMY() as I thought it should. But that process still generates 2 curves, instead of leaving out the intermediate step if I could stack the equation.

But I'll make that work.

Thanks for the reply.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Ack! I now notice I've never included the "Running Total" plugin with the distribution. Probably because I didn't get around to allow you to specify which curves to operate on - it will always operate on ALL curves, meaning you end up with twice as many curves as you started with, plus your originals will always be preserved.

If you're interested you can get it from http://www.dplot.com/plugins/generate/runsum.dll

Copy that file to [dplot folder]\plugins\generate.

"Integrate a Curve" is equivalent ONLY if your data starts at Y=0 and X is incremented by 1. "Integrate..." gives you a running area under a curve, while "Running Total" does pretty much what you'd expect it to do.

Back to your original question, it looked like you wanted to sum Y's based on whether an existing Y was greater than some constant. There's no way to do that presently but in the context of your question I don't get the negative on producing a second curve. I suppose "Running Total" should prompt for whether to preserve or discard the data you're operating on. SUM() still can't be used in that context, but that's a simple enough addition I think.
Visualize Your Data
support@dplot.com
jsc
Posts: 222
Joined: Fri Dec 02, 2005 8:56 am

Post by jsc »

Thanks, but runsum is not quite ready for prime time! (Definitely needs to be able to select a curve(s), and the generated curves are not labeled.) Guess I'll stick with what I'm doing. I have 4 or 5 data curves, and using stacked IF statements comparing Y values in several of the curves, I assign 1 or 0 in 1 second intervals (or .5 second then divide/2 later on). Then I sum that conditional curve for a cumulative total using SUMY(n). If I could SUMY the stacked IF curve I could eliminate 1 curve each time I do this. Of course, I guess I could delete the IF curve after I make the SUMY() curve and effectively do the same thing. It just seems that I keep bumping into the 9 curve limit by a curve or 2.
Post Reply