### - Qucs -
Quite Universal Circuit Simulator

# Short Description of mathematical Functions

The following operations and functions can be applied in Qucs equations.

`+x` | unary plus
`-x` | unary minus
`x+y` | addition
`x-y` | subtraction
`x*y` | multiplication
`x/y` | division
`x%y` | modulo (remainder of division)
`x^y` | power
`max(x[,range])` | maximum value in vector; if a `range` is given then `x` must have a single data dependency
`max(x,y)` | returns the greater of the values `x` and `y`
`min(x[,range])` | minimum value in vector; if a `range` is given then `x` must have a single data dependency
`min(x,y)` | returns the lesser of the values `x` and `y`
`avg(x[,range])` | arithmetic average of values in vector; if a `range` is given then `x` must have a single data dependency
`cumavg(x)` | cumulative average of values in vector
`runavg(x)` | running average of values in vector
`stddev(x)` | standard deviation of values in vector
`variance(x)` | variance of values in vector
`rms(x)` | root mean square of a vector
`sum(x)` | sum of values in vector
`prod(x)` | product of values in vector
`cumsum(x)` | cumulative sum of values in vector
`cumprod(x)` | cumulative product of values in vector
`diff(y,x)` | differentiates vector y with respect to x
`diff(y,x,n)` | differentiates vector y with respect to x n-times
`integrate(x,h)` | integrates vector `x` numerically assuming a constant step-size `h`
`real(x)` | real part of complex number
`imag(x)` | imaginary part of complex number
`abs(x)` | absolute value, magnitude of complex number
`mag(x)` | same as abs(x)
`polar(m,p)` | returns complex number based on magnitude and phase
`norm(x)` | square of mag(x)
`conj(x)` | conjugate complex
`phase(x)` | phase in degree
`angle(x)` | phase in radians
`arg(x)` | same as angle(x)
`deg2rad(x)` | converts degrees to radians
`rad2deg(x)` | converts radians to degrees
`unwrap(rad[,tol])` | unwraps the angle (in radians) using the optional tolerance value (default is pi)
`dB(x)` | voltage decibel
`dbm(x)` | convert voltage to power in dB
`dbm2w(x)` | convert power in dBm to power in Watts
`w2dbm(x)` | convert power in Watts to power in dBm
`sqr(x)` | square (x to the power of two)
`sqrt(x)` | square root
`exp(x)` | exponential function to basis e
`ln(x)` | natural logarithm
`log10(x)` | decimal logarithm
`log2(x)` | binary logarithm
`sin(x)` | sine
`cos(x)` | cosine
`tan(x)` | tangent
`sinh(x)` | sine hyperbolicus
`cosh(x)` | cosine hyperbolicus
`tanh(x)` | tangent hyperbolicus
`arcsin(x)` | arcus sine
`arccos(x)` | arcus cosine
`arctan(x[,y])` | arcus tangent
`arccot(x)` | arcus cotangent
`arsinh(x)` | area sine hyperbolicus
`arcosh(x)` | area cosine hyperbolicus
`artanh(x)` | area tangent hyperbolicus
`arcoth(x)` | area cotangent hyperbolicus
`sec(x)` | secans
`cosec(x)` | cosecans
`cot(x)` | cotangent
`sech(x)` | secans hyperbolicus
`cosech(x)` | cosecans hyperbolicus
`coth(x)` | cotangent hyperbolicus
`ztor(x[,zref])` | converts impedance to reflexion coefficient (by default reference is 50 ohms)
`rtoz(x[,zref])` | converts reflexion coefficient (by default reference is 50 ohms) to impedance
`ytor(x[,zref])` | converts admittance to reflexion coefficient (by default reference is 50 ohms)
`rtoy(x[,zref])` | converts reflexion coefficient (by default reference is 50 ohms) to admittance
`rtoswr(x)` | converts reflexion coefficient to (voltage) standing wave ratio (SWR or VSWR)
`stos(s,zref[,z0])` | converts s-parameter matrix to s-parameter matrix with different reference impedance(s)
`stoy(s[,zref])` | converts s-parameter matrix to y-parameter matrix
`stoz(s[,zref])` | converts s-parameter matrix to z-parameter matrix
`ytos(y[,z0])` | converts y-parameter matrix to s-parameter matrix
`ytoz(y)` | converts y-parameter matrix to z-parameter matrix
`ztos(z[,z0])` | converts z-parameter matrix to s-parameter matrix
`ztoy(z)` | converts z-parameter matrix to y-parameter matrix
`twoport(m,from,to)` | converts the given 2-port matrix from one representation into another, possible values for `"from"` and `"to"` are 'Y', 'Z', 'H', 'G', 'A', 'S' and 'T'.
`ceil(x)` | rounds to the next higher integer
`fix(x)` | truncates decimal places from real number
`floor(x)` | rounds to the next lower integer
`round(x)` | rounds to nearest integer
`sign(x)` | computes the signum function
`sinc(x)` | returns sin(x)/x and one at x=0
`step(x)` | step function
`besseli0(x)` | modified Bessel function of order zero
`besselj(n,x)` | 1st kind Bessel function of n-th order
`bessely(n,x)` | 2nd kind Bessel function of n-th order
`erf(x)` | error function
`erfc(x)` | complementary error function
`erfinv(x)` | inverse error function
`erfcinv(x)` | inverse complementary error function
`det(x)` | determinant of x
`transpose(x)` | transposed matrix of x (rows and columns exchanged)
`inverse(x)` | inverse matrix of x
`eye(n)` | n x n identity matrix
`adjoint(x)` | adjoint matrix of x (transposed and conjugate complex)
`Rollet(x)` | Rollet stability factor of matrix x (twoport S-parameter matrix)
`Mu(x)` | Mu stability factor of matrix x (twoport S-parameter matrix)
`Mu2(x)` | Mu' stability factor of matrix x (twoport S-parameter matrix)
`linspace(from,to,n)` | creates a vector with `n` linearly spaced elements between `from` and `to`, both inclusively
`logspace(from,to,n)` | creates a vector with `n` logarithmically spaced elements between `from` and `to`, both inclusively
`NoiseCircle(Sopt, Fmin,Rn,F[,Arcs])` | circles with constant noise figure(s) `F` (can be a constant or a vector), `Arcs` specifies the angles in degree created by e.g. `linspace(0,360,100)`, if `Arcs` is a number it specifies the number of equally spaced circle segments, if it is omitted this number defaults to a reasonable value
`StabCircleS(S [,Arcs])` | stability circle in the source plane
`StabCircleL(S [,Arcs])` | stability circle in the load plane
`GaCircle(S,Ga [,Arcs])` | circle(s) with constant available power gain `Ga` in the source plane
`GpCircle(S,Gp [,Arcs])` | circle(s) with constant operating power gain `Gp` in the load plane
`PlotVs(data,dep)` | returns a data item based upon `data` (vector or matrix vector) with dependency on the given `dep` vector, e.g. `PlotVs(Gain,frequency/1e9)`
`interpolate(f,x[,n])` | returns an interpolated data vector of the real function `f(x)`using `n` equidistant datapoints, the latter can be omitted and defaults to a reasonable value
`fft(x)` | computes the fast fourier transformation (FFT) of the vector `x`
`ifft(x)` | computes the inverse fast fourier transformation (IFFT) of the vector `x`
`dft(x)` | computes the discrete fourier transformation (DFT) of the vector `x`
`idft(x)` | computes the inverse discrete fourier transformation (IDFT) of the vector `x`
`Time2Freq(v,t)` | computes the discrete fourier transformation of the function `v(t)` interpreting it physically
`Freq2Time(V,f)` | computes the inverse discrete fourier transformation of the function `V(f)` interpreting it physically
`kbd(x [,n])` | Kaiser-Bessel derived window
`yvalue(f,xval)` | returns the y-value of the given vector `f` which is located nearest to the x-value `xval`; therefore the vector `f` must have a single data dependency
`xvalue(f,yval)` | returns the x-value which is associated with the y-value nearest to `yval` in the given vector `f`; therefore the vector `f` must have a single data dependency

Range nomenclature

`LO:HI` | range from `LO` to `HI`
`:HI` | up to `HI`
`LO:` | from `LO`
`:` | no range limitations

Matrix nomenclature

`M` | the whole matrix M
`M[2,3]` | element being in 2nd row and 3rd column of matrix M
`M[:,3]` | vector consisting of 3rd column of matrix M

Name of values

`S[1,1]` | S-parameter value
nodename`.V` | DC voltage at node nodename
name`.I` | DC current through component name
nodename`.v` | AC voltage at node nodename
name`.i` | AC current through component name
nodename`.vn` | AC noise voltage at node nodename
name`.in` | AC noise current through component name
nodename`.Vt` | transient voltage at node nodename
name`.It` | transient current through component name

Note: All voltages and currents are peak values.
Constants

`j` | imaginary unit ("square root of -1")
`pi` | 4*arctan(1) = 3.14159...
`e` | Euler = 2.71828...
`kB` | Boltzmann constant = 1.38065e-23

back to the top