Subtracting 2 curves

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

Moderator: DPlotAdmin

Post Reply
bfennema
Posts: 7
Joined: Sun Oct 23, 2011 4:31 am
Location: Bray, Ireland

Subtracting 2 curves

Post by bfennema »

One of the things I need to do is to subtract two curves. They are both plotted against time.

I tried F(X,Y1,Y2)

As an example I am trying to subtract

Y1:sin(x)
Y2= 2* sin(x) + 10

I use Generate F(X,(y1-y2)

and get the error message

"too many parameters at X=0."

I tried straight lines and with the same message and I tried excluding 0 from the start, with the same result.

So I think I am doing something wrong, but cannot see what.

Any ideas ?


P.s. I also found the SubtractCurves macro - how do I execute this in DPlot ?

Thanks for the help,

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

Post by DPlotAdmin »

The function you want is simply
Y1-Y2
(or Y2-Y1).

SubtractCurves does exactly the same thing. To use it in a macro just type
SubtractCurves(1,2) (or whatever curve indices are appropriate).
Visualize Your Data
support@dplot.com
bfennema
Posts: 7
Joined: Sun Oct 23, 2011 4:31 am
Location: Bray, Ireland

Post by bfennema »

Worked as you said - I thought F(x) needed to be included in the syntax - my mistake.

B.
Best regards,

Boris Fennema
dcl9000
Posts: 26
Joined: Mon Mar 28, 2011 8:15 pm

Y=f(X,Y1,Y2,...) works for the first 9 curves only!

Post by dcl9000 »

Hi!

Is there a way to remove this 9 curves limit? I have 12 curves....
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Sorry, no. That's a poor design decision on my part that I haven't worked around yet, but hope to sooner or later.

If you want the nuts and bolts of it, the function parser I use (which is otherwise excellent) takes letters A-Z as variables - 1 character only. DPlot reserves A-K as constants (skipping E because that would be confusing) and substitutes the next 9 letters L-T for Y1 - Y9. X, Y, and Z are reserved for obvious reasons. That leaves U, V, W for Y10, Y11, Y12, which I could do easily enough. But I'd rather remove the 1-character limitation so that you could have Y1-Y<whatever>.
Visualize Your Data
support@dplot.com
jsc
Posts: 222
Joined: Fri Dec 02, 2005 8:56 am

Post by jsc »

Just to horn in, I'm bumping the 9 curve limit on one of the projects that I use DPlot for, so a few more curves would be nice! I'm shuffling curves to another plot, then adding them back to the mix. 2 or 3 more would be helpful. More than that, and I'm beyond MY limit to keep track of what I'm doing!
dcl9000
Posts: 26
Joined: Mon Mar 28, 2011 8:15 pm

Post by dcl9000 »

Hope this limit can be removed soon.....
Thanks!
Post Reply