Variable operations

  • Updated

In addition to basic arithmetic operations like adding, subtracting, multiplying, and dividing, there are several advanced functions that can be used in the equation editor. They are described in detail below.

 

Function Description Syntax Notes Examples
max of 2 Returns the largest value in a set of arguments maximum(a_1, a_2) Arguments can be a variable, a constant, or a mathematical function of two or more variables MAX (variable1, variable2)
MAX (variable1, 100)
MAX (variable1 - variable2, 0)
min of 2 Returns the smallest value in a set of arguments minimum(a_1, a_2) Arguments can be a variable, a constant, or a mathematical function of two or more variables MIN (variable1, variable2)
MIN (variable1, 100)
MIN (variable1 - variable2, 0)
frequency (s) Returns the frequency of the variable in seconds frequency The frequency of the variable is set in the "Edit" menu and can have values of 1 minute, five minutes, quarter hourly, etc.
Mathematical operations can be performed on the frequency function. For example, 2*frequency will double the result of the frequency function.
If the virtual variable has a Frequency set to 1 minute, the frequency function will return 60.
If the virtual variable has a Frequency set to hourly, the frequency function will return 3600.
abs Returns the absolute value of the expression abs(a_1) Arguments can be variables, constants, or mathematical functions of two or more variables ABS (variable1)
ABS (variable1 - variable2)
ABS (variable1 - 500)
clip Removes the values outside a specified boundary defined by a minimum and maximum limit clip(a_1, a_min, a_max) Argument a_1 is the variable of interest. Arguments a_min and a_max represent the upper and lower bounds to restrict argument a_1. Arguments a_min and a_max can be variables or constants. CLIP (variable1, 25, 50)
CLIP (variable1, variable2, 100)
sign Evaluates the sign of an argument.
Returns a 1 for positive values, returns a -1 for negative values, returns a 0 for zero values
sign(a_1) Arguments can be a variable, a constant, or a mathematical function.
When the argument is a variable, the SIGN function is only valid when the display Frequency matches the variable Frequency
SIGN (variable1)
SIGN (variable1 + 1,000,000)
SIGN (variable1 - variable2)
SIGN (8.6) = 1
SIGN (-12) = -1
ceil Returns the next integer, rounded up. Positive numbers round up away from zero; negative numbers round up toward zero ceil(a_1) Arguments can be a variable, a constant, or an equation. CEIL (variable1)
CEIL (2*variable1 + variable2)
CEIL (2.001) = 3
CEIL (-2.1) = -2
CEIL (-10.9) = -10
round Returns the rounded values of an argument to a specified number of decimal places round(a_1,num_digits) Arguments can be a variable, a constant, or an equation. The second argument, num_digits, specifies the number of decimal points to be kept when rounding. The default number is zero. ROUND (variable1)
ROUND (2*variable1 + variable2, 1)
ROUND (15.21654984, 3) = 15.217
ROUND (2.8) = 3
floor Returns the next integer, rounded down. Positive numbers round down toward zero; negative numbers round down away from zero floor(a_1) Arguments can be a variable, a constant, or an equation. FLOOR (variable1)
FLOOR (2*variable1 - variable2)
FLOOR (6.5) = 6
FLOOR (-6.5) = -7
gradient Returns a partial derivative at each point gradient(a_1) Arguments can be variables or equations containing variables.
The gradient is calculated using the central finite difference model, which takes the difference in the two y-axis values on either side of the point of interest divided by the difference between the two x-axis values on either side of the point of interest.
Gradient at x2 = (y3 - y1) / (x3 - x1)
GRADIENT (variable1)
exp Returns the value of the natural exponential function raised to the power of the argument. exp(a_1) Arguments can be a variable or a constant.
The constant e equals approximately 2.718, the base of the natural logarithm.
EXP (variable1)
EXP (1) = 2.718
EXP (0) = 1
log Returns the value of the logarithm of the argument exp(a_1, [a_2]) Arguments can be a variable or a constant.
Argument a_2 sets the base of the log function. An argument for the base is optional, and if omitted, it is assumed to be e.
LOG (variable1)
LOG (variable1, 10)
LOG (EXP (variable1)) = variable1
LOG (1) = 0
LOG (10) = 2.3
LOG (10, 10) = 1

Was this article helpful?

/

Comments

0 comments

Please sign in to leave a comment.