- STFunc-expression
expression (STFunc)¶
Works with VSimBase, VSimEM, VSimPD, VSimPA, and VSimVE licenses.
Function that can be defined by an arbitrary mathematical expression.
expression Parameters¶
- expression (string)
Expression to be evaluated, involving the arithmetic operators + (addition), - (subtraction), * (multiplication), / (division), and ** (exponentiation), and the below functions of position and/or time:
Function
Mathematical Description
General Description
pow(x,y)
\(x^y\)
exponential, arbitrary base
exp(x)
\(e^x\)
exponential, base \(e\)
sin(x)
\(\sin\left(x\right)\)
sine
cos(x)
\(\cos\left(x\right)\)
cosine
tan(x)
\(\tan\left(x\right)\)
tangent
asin(x)
\(\arcsin\left(x\right)\), \(x \in \left[-1,1\right]\)
inverse sine
acos(x)
\(\arccos\left(x\right)\), \(x \in \left[-1,1\right]\)
inverse cosine
atan(x)
\(\arctan\left(x\right)\), \(x \in \left[-\pi/2,\pi/2\right]\)
inverse tangent
atan2(y,x)
\(\arctan\left(y/x\right)\); \(x\) and \(y\) not both 0,
inverse tangent, returns angles in correct quadrant
\(x=0\) returns \(\pm \pi/2\)
sinh(x)
\(\sinh\left(x\right)\)
hyperbolic sine
cosh(x)
\(\cosh\left(x\right)\)
hyperbolic cosine
tanh(x)
\(\tanh\left(x\right)\)
hyperbolic tangent
ln(x)
\(\log_e\left(x\right)\)
logarithm, base \(e\)
log(x)
\(\log_e\left(x\right)\)
logarithm, base \(e\)
log10(x)
\(\log_{10}\left(x\right)\)
logarithm, base \(10\)
mod(x,y)
\(x - \lfloor x/y \rfloor y\)
floating point remainder
inv(x)
\(-x\)
additive inverse
H(x)
\(H\left(x\right)=\left\{\begin{array}{lr}0 & , x<0\\0.5 & , x=0\\1 & , x>0\end{array}\right.\)
Heaviside step function
J0(x)
\(J_0\left(x\right)\)
Bessel function of the first kind, order 0
J1(x)
\(J_1\left(x\right)\)
Bessel function of the first kind, order 1
J2(x)
\(J_2\left(x\right)\)
Bessel function of the first kind, order 2
J3(x)
\(J_3\left(x\right)\)
Bessel function of the first kind, order 3
abs(x)
\(\left|x\right|\)
absolute value
sqrt(x)
\(\sqrt{x}\)
square root
rand(x)
uniform random number in \(\left[0, 1\right)\), independent of \(x\)
gauss(x,y)
Gaussian random number with standard deviation \(x\) and mean \(y\)
ceil(x)
\(\lceil x \rceil\)
smallest integer not less than x
floor(x)
\(\lfloor x \rfloor\)
largest integer not greater than x
min(x,y)
\(x\) if \(x \le y\), else \(y\)
minimum
max(x,y)
\(x\) if \(x \ge y\), else \(y\)
maximum
Example expression Block¶
<STFunc component0>
kind = expression
expression = 100.*sin(2.0e9*t)
</STFunc>