Navigation:  Menu Commands > Generate Menu >

Y=f(X,Y1,Y2,...) command (Generate menu)

JR   Viewer

Print this Topic Previous pageReturn to chapter overviewNext page

Generates X,Y pairs using a function of X and/or one or more Y values from existing curves. Y values from existing curves are included in the equation as "Yn", where n is the index of the curve. You are limited to the first nine existing curves (Y1, Y2, ... Y9). Curves used in the equation must have monotonically increasing X values.

Use X values from curve

If checked, then the output curve will use X values from the 1-based curve index specified in the adjacent text box. If unchecked, the output curve will have evenly-spaced X values between the from X and to X values with interval DX.

If Use X values from curve is unchecked and you leave either the from X or to X boxes blank, DPlot assigns default values as follows:

If the equation includes Y terms, the from X value is set to the maximum starting X value for all curves included in the equation. The to X value is set to the minimum ending X value for those same curves.

Otherwise, if the document contains any curve, from X is set to the minimum starting X for all curves; to X is set to the maximum ending X value.

If the document contains no curves, from X is set to 0 and to X is set to 1.

For every generated X value, if the equation contains Y terms then DPlot interpolates the appropriate curve to find the value of Y to substitute in the equation. If X is outside the extents of the curve, then the corresponding Y value is set to 0.

Prevent divide by zero errors

If this box is unchecked, DPlot will trap divide by zero and many other math errors (e.g. logarithm of a non-positive value), report the value of x where the error occurred, and will not generate a curve. If this box is checked and the equation has one or more X terms, when DPlot traps a math error it will shift x by a very small number and attempt the calculation again. This feature might be useful for generating curves of certain functions that would normally fail at specific values of x, e.g. sin(x)/x at x=0.

Expand constants in legend

If unchecked, the legend for a generated curve will generally match the equation as entered (plus a few formatting changes for subscripts and superscripts). If checked, any constants in the equation will be replaced by their numeric values. For example, with Y=A+B*x+C*x^2+D*x^3+F*x^4 and Expand constants in legend unchecked, the legend will be A+B*x+C*x2+D*x3+F*x4. With Expand constants in legend checked, the legend might be 1.111-0.4366*x+0.04882*x2-0.001627*x3+5.613e-016*x4. If this expansion results in a character string longer than 80 characters, the constants A,B,C,etc. will be used.

Open/Save as

These buttons allow you to read or save the entire setup for this function, including the equation, extents, constants, and other options. This might be handy if you have an operation that you frequently use and you use this command often enough that a particular operation migrates out of the most-recently-used list. We strongly suggest that you use the default folder location when saving a setup, so that you don't confuse the setup for this function with that for the Y=f(X) or X=f(T), Y=g(T) commands. (The saved files for the various Generate commands are not compatible.)

Function (sin, cos, etc.) arguments must be in parentheses. See the list of available functions.

You can use placeholder codes for certain data parameters. For example “$YMAX(2)” will be replaced with the maximum Y value of the second curve. For more information on placeholder codes click here.

You can create conditional equations with the if function. The if function takes the form if(test,if_true,if_false), where test is the condition you want to check, if_true is the value the equation takes if test is true, and if_false is the value taken if test is false. For example, "if x > 5 then z=x^2, otherwise z=(10-x)^2" can be expressed with if(x<5,x^2,(10-x)^2).

By default, angular input values are in radians. You can set angles to degrees by clicking the degrees option button.

DPlot will automatically substitute the value of pi (3.141592653589793...) for "PI", "pi", or "Pi"

NOTE: Be specific. DPlot does not interpret "2X" as "2*X".



This example shows a curve fit to input data and the square of the errors between the curve fit and the input. The third curve was generated with the equation "(Y2-Y1)^2".

Tip: You can hide the legend by right-clicking and selecting Hide Legend. Move the legend by clicking and dragging. Other legend parameters are accessible via the right-click menu, or by selecting the Legend/Labels command on the Text menu.



Related macro commands










Page url: