Plots a function (R.W. Payne).
||Function to plot|
||Title for the plot; default shows the function|
||Colour of the function curve; default
||Which graphics window to use; default 3|
||Elevation of the viewpoint for the surface that is plotted when there are two arguments; default 25 (degrees)|
||Rotation about the horizontal plane for the viewpoint of a surface plot; default 225 (degrees)|
||Distance of the viewpoint of a surface plot from the centre of the grid on the base plane; default
||defines the scaling of the z-axis relative to the horizontal (x-y) axes in a surface plot; default 1|
||Whether to clear the screen before plotting (
||Arguments of the function|
||Lower values of the arguments for the plot|
||Upper values of the arguments for the plot|
||Steps at which to evaluate the function|
DFUNCTION plots a function using high-resolution graphics. The function is specified, as a Genstat expression, using the
The arguments of the function (against which the function is to be plotted) are specified by the
ARGUMENT parameter. There can be either one or two arguments, and they must each be either a scalar or an undeclared data structure. With one argument a curve is plotted using
DGRAPH, while with two arguments a surface is plotted using
UPPER parameters specify the lower and upper values of the arguments to show in the plot. The
STEP parameter specifies the step between the values of each
ARGUMENT at which the
FUNCTION is evaluated in the plot. The default generates 1001 values of a single argument, or 101 values of each argument if there are two.
TITLE option can supply a title for the plot. If this is not specified, a title is constructed automatically to show the
FUNCTION expression. The
COLOUR option specifies the colour to use for the function curve or suface. The default is to plot it in green. The
WINDOW option specifies which graphics window to use. The default is to use window 3, which should fill the whole frame. The
SCREEN option controls whether the screen is cleared before plotting, or whether is is kept, or kept with resizing, from previous plots. By default the screen is cleared.
ZSCALE are relevant only when a surface is plotted (i.e. when there are two arguments), and all operate as in the
DSURFACE directive. The
AZIMUTH options specify the position of the viewpoint, and the
ZSCALE option specifies a scaling factor for the z-axis that is used for the function, versus the x- and y-axes that are used for the arguments. See
DSURFACE for further details.
Commands for: Graphics.
CAPTION 'DFUNCTION examples'; STYLE=meta DFUNCTION [FUNCTION=x+x*log(x)] x; LOWER=0.0001; UPPER=1 " Notice that the evaluation at 0 gives a missing value, which breaks up the curve into 2 separate parts (and generates a warning)." DFUNCTION [FUNCTION=1/x] x; LOWER=-1; UPPER=1 DFUNCTION [FUNCTION=100*(P2-P1*P1)**2+(1-P1)**2] P1,P2;\ LOWER=-1.2,0; UPPER=1.2