
 
Dataplot Elementary Operations 

Contents  We discuss the following elementary Dataplot operations:  


Arithmetic Operations 

Supported Symbols for Arithmetic Operations 
As with Fortran, the Dataplot language uses the following
symbols for arithmetic operations:


Priority of Operations 
Also, operations are performed left to right with priorities
defined in a fashion identical to Fortran:


Use of Parentheses  As with Fortran, the order of operations can be altered by the use of parentheses. Operations in parentheses are performed first.  
Use of Arithmetic Operations with the Three Most Important Dataplot Commands 
The three most important Dataplot commands are


Arithmetic Operations Used in Function Defitions 
Arithmetic operations are also used in the definition of
functions. For example
LET FUNCTION G = 10*Y LET FUNCTION H = A+F/G 

[ Dataplot / Dataplot Elementary Operations ]  


Relational Operators 

Six Relational Operators 
Dataplot has six relational operators:


Do Not Include Spaces Within a Relational Operator 
The spacing within such operators is important. For example,
using > = instead of >= will lead to a syntax error or possible
erroneous results. Thus to generate a plot of Y versus X but
with the plot restricted to those X and Y values for which the
LAB variable is 7 or greater, the proper entry is


Spacing Around Relational Operators is Optional 
Spacing around such relational operators is optional and at the
analyst's discretion. Using spaces around relational operators
generally provides better human readability. The following are
equivalent:
PLOT Y X SUBSET LAB>=7 FIT Y = A+B/X FIT Y=A+B/X LET Y = (X**LAMBDA)/(LAMBDA+1) LET Y=(X**LAMBDA)/(LAMBDA+1) 

[ Dataplot / Dataplot Elementary Operations ]  


Functions 

Functions Are Named Character Strings 
A function is a named character string, and may be defined via the
LET FUNCTION command, as in
LET FUNCTION G = SIN(2*PI*W*T) LET FUNCTION H = F+LOG(G) LET FUNCTION F2 = DERIVATIVE F WRT X 

Functions Can Be Concatenated 
Functions can be concatenated and builtup piecebypiece, as in
LET FUNCTION DENOM = A+B*X LET FUNCTION RATIO = NUM/DENOM


Parameters and Variables Need Not Be Defined First 
Functions can be defined before (or after) the parameters and
variables contained in them are created, as in the following
example involving a variable transformation:
. SERIAL READ X 1 2 3 END OF DATA . LET Y = F
A more common example of functions being defined prior to use is in fitting:
LET FUNCTION F2 = A2+82*LOG(X) . READ X Y 1 1 2 1.5 3 2 4 2.3 5 2.5 END OP DATA . FIT Y = F1 FIT F = F2 

BuiltIn Functions  Dataplot provides a large number of builtin functions which can be used in userdefined functions.  
[ Dataplot / Dataplot Elementary Operations ]  


Evaluating Functions 

Distinction Between LET FUNCTION and LET  The LET FUNCTION command and the LET command carry out two distinctly different operations. The LET FUNCTION command allows the analyst to create functions; the LET command allows the analyst to carry out function evaluations.  
Example of the Distinction 
For example, suppose it is desired to evaluate the function
sqrt(10.3*x**2) over the region x = 0 (.01) 2. This may be
done in a number of ways. The most direct way is
LET Y = SQRT(10.3*X**2) WRITE X Y PLOT Y X A second way to evaluate the function would be
LET FUNCTION F = SQRT(10.3*X**2) LET Y = F WRITE X Y PLOT Y X Note that if our ultimate objective is to simply plot the function (rather than creating variables containing evaluated values of the function), then the above code could be shortened directly to
PLOT F FOR X = 0 .01 1 

[ Dataplot / Dataplot Elementary Operations ]  


LET SubCommands 

LET Single Most Powerful Dataplot Command  The LET command is the single most powerful commmand in DATAPLOT. The most important capability of the LET command is performing function evaluations and variable transformations. Such evaluations/transformations are generalany Fortranlike expression can be used.  
Four General Categories of LET Sub Commands 
In addition, the LET command can also be used to perform a broad spectrum of statistical, mathematical, and manipulative operations. These operations are specified by inclusion of subcommands under the LET command. These subcammands fall into four general categories:  
Privacy
Policy/Security Notice
NIST is an agency of the U.S. Commerce Department.
Date created: 6/5/2001 