Navigation:  Menu Commands > Generate Menu >

Y=f(X) command

JR   Viewer

Print this Topic Previous pageReturn to chapter overviewNext page

Generates X,Y pairs between a start and end point with a specified interval using a function that you specify.

Available operators are +, -, *, /, ^,>,<, and =. The inequality operators (>, <, and =)  result in 1.0 if the condition is true, 0.0 otherwise.

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 y=x^2, otherwise y=(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".

Example:

With radians selected, Y=sin(Pi*x)

from X=0 to 2 results in:

This command makes use of the RunicSoft Function Parser from Andreas Hartl (FParser.dll in the DPlot folder).

Prevent divide by zero errors
If this box is unchecked, DPlot will trap divide by zero errors, report the value of x where the error occurred, and will not generate a curve. If this box is checked, when DPlot traps a divide by zero 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.

Constants

You can specify up to 10 constants to use in place of numerical values in your equation. Often the use of constants will make your equation more readable and less error-prone. For example, the Planck law for blackbody radiation as a function of wavelength is given by:

where

h =Planck's constant, 6.6262E-27 erg-sec

c = the speed of light, 2.99792458E+8 meters/sec

k = Boltzmann's Constant, 1.3807E-16 erg/deg. K

T = temperature, deg. K

Without using constants this equation can be expressed in DPlot as

y = 2*6.6262E-27*2.99792458E+8^2/x^5/(exp(6.6262E-27*2.99792458E8/(x*1.3807E-16*200))-1)

(for T=200K) which is a bit hard to decipher. Instead, you can use

y = 2*h*c^2/x^5/(exp(h*c/(x*k*200))-1) with c, h, and k defined as shown below:

Repeating for several temperatures gives:

 


Page url: http://www.dplot.com/help/index.htm?helpid_f_of_x.htm