Go back to: 
The blocks here make use of LTspice's builtin mathematical functions, plus a few others. The appearance of the symbols was made with the thought of uniformity in mind and a more streamlined approach, which makes possible changing the function of the symbol on the fly. Placing the Math1
symbol with its default abs
value means the symbol will perform the abs()
function. Changind the functions can be done by either renaming or by rightclicking the symbol and selecting the desired entry from the dropdown menu. For example switching from sin()
to cos()
means renaming sin
to cos
, or having ba
instead of ab
means adding a +
after 
, as can be seen in the images below:
This also means that the schematic will look uniform, all the mathematical functions will look the same so they will be easily recognized, while, at the same time, their functions will be clearly spelled out.
The library files are divided into three: mathfunc.sub
, holding the constant value block and the 5input summer, mathfunc1.sub
, holding the onevariable functions (e.g. sin(x), x
being the input), and mathfunc2.sub
, holding the twovariable functions (e.g. atan2(a,b)
, a
and b
being the inputs). Sometimes, in addition to the usual input(s) as variable(s), there are some other parameters that can be defined, e.g. the atan2
block has the additional parameters a
(the signum for the input a
), b
(the signum for the input b
) and dc
(the DC offset). All the blocks have floating input and 1Ω output resistance, unless otherwise noted. The list of blocks inside [Math]
is as follows:
Const 
mathfunc.sub 
Constant value, though it's a Bsource inside so it can have functions, too. 
Math1 
mathfunc1.sub 
Onevariable input functions. Unlike Math2 , the names are the same as their LTspice counterparts. Some of them have additional parameters, this is the list:
function 
additional parameters 

1/x 
y sets the minimum number to avoid division by zero, the output will be maximum of 1/y 
abs 

acos 
phi sets the phase 
acosh 

asin 
phi sets the phase 
asinh 

atan 
phi sets the phase 
atanh 

ceil 

cos 
phi sets the phase 
cosh 

exp 

floor 

int 

ln 

log 

log10 

mod1 
V(in) is divided to y , mod(V(in),y) 
pow 
y is the exponent as defined by LTspice, pow(V(in),y) 
pwr 
y is the exponent as defined by LTspice, pwr(V(in),y) 
pwrs 
y is the exponent as defined by LTspice, pwrs(V(in),y) 
quant 
y is the number the quantizing is done with, int(V(in)*y)/y 
round 

sgn 
y sets the offset, sgn(V(in)+y) 
sin 
phi sets the phase 
sinh 

sqrt 

tan 
phi sets the phase 
tanh 

u 
y sets the offset, u(V(in)+y) 
uramp 
y sets the offset, uramp(V(in)+y) 

Math2 
mathfunc2.sub 
Twovariables input functions. This is the list:
function 
name 
additional parameters 
a+b 
+ 

ab 
 

ba 
+ 

a*b 
* 

a/b 
/ 
min sets the minimum number to avoid division by zero, abs(V(b))/min 
b/a 
/* 
min sets the minimum number to avoid division by zero, abs(V(a))/min 
a==b 
~~
(LTspice allows "==" as naming but doing so won't have any effect) 

a<>b 
<> 

atan2(a,b) 
atan2 
a sets the signum of V(a) , b sets the signum of V(b) and dc sets the DC offset added to the total:
atan2( sgn(a)*V(a), sgn(b)*V(b) ) + dc 
hypot(a,b) 
hypot 

max(a,b) 
max 

min(a,b) 
min 

mod(a,b) 
mod 


Math2r 
mathfunc2.sub 
The same functions as Math2 only with a round symbol and 90^{o} inputs. 
Math2rT 
mathfunc2.sub 
The same functions as Math2 only with a round symbol and opposite inputs. 
Math5 
mathfunc5.sub 
5input sum/difference, any combination possible, except nulls (this may replace Math5r in the future):
+++++
++++
++++
++++
++++
++++
+++
+++
+++
+++
+++
+++
+++
+++
+++
+++
++
++
++
++
++
++
++
++
++
++
+
+
+
+
+
 
Math5r 
mathfunc.sub 
5input summer. 
All the models are archived inside one file and are available in two flavours:
©Vlad, 2014  2015