Functions
Functions
Reference Manual
Measurement Expressions Reference Manual
Gunther Kraut
Permission is granted to copy, distribute and/or modify this document under the terms of
the GNU Free Documentation License, Version 1.1 or any later version published by the
Free Software Foundation. A copy of the license is included in the section entitled ”GNU
Free Documentation License”.
Introduction
This manual describes the measurement expressions available in ”Qucs”, the ”Quite Uni-
versal Circuit Simulator”.
Measurement expressions come into play whenever the results of a ”Qucs” simulation run
need post processing. Examples would be the conversion of a simulated voltage waveform
from volts to dBV, the root mean square value of that waveform or the determination of
the peak voltage. The ”Qucs” measurement functions offer a rich set of data manipulation
tools.
If you are not familiar with the way how to enter those formulas, please refer to chapter
“Using Measurement Expressions”, which points out the possibilities to create and change
measurement expressions. Also the data types supported are specified here. Chapter
“Functions Syntax and Overview” introduces the basic syntax of functions and a categorical
list of all functions available. The core of the document, a detailed compilation of all ”Qucs”
functions divided into different categories, is presented in chapter “Math Functions” and
chapter “Electronics Functions”. Finally, the appendix contains an alphabetical list of all
functions.
The chapter describes the usage of mathematical expressions for post processing simulation
data in “Qucs”, how to enter formulas and modifying them. It gives a brief description of
the overall syntax of those expressions.
1
Figure 1: Entering a new measurement expression via equation icon
You can now place the equation symbol by mouse click anywhere in the schematic. Each
mouse click creates a new equation instance each consisting of a variable number of mea-
surement expressions. Press the Esc key if you do not like further equations.
Another option is to select an existing equation, copy it (either by menu item “Edit” →
”Copy” or by Ctrl + C 1 ) and paste it (either by menu item “Edit” → ”Paste” or by Ctrl
+ V ).
After having successfully created an equation instance, you are now able to modify it.
For sake of simplicity we assume that you have just generated a new equation - if you like
to change an existing, more complicated equation the following steps are the same.
Thus, the excerpt of your schematic surface looks like that in fig. 2.
You can now manipulate the current name of the equation instance. Simply click onto
“Eqn1”, which becomes highlighted. Then type in a new name for it and finalise your
inputs with the Enter key.
After that, you can enter a new equation. Again, click onto “y=1”. Only the “1” is marked,
1
Ctrl + C means that you have to press the Ctrl key and the C key simultaneously.
2
Figure 2: Newly created equation
and you can enter a new expression there. Please use the variables, operators and constants
described in chapter “Syntax of Measurement Expressions”. Note that you can also refer
to results (dependents) of other equations. But how to change the name of the current
dependent “y”? Right click onto the equation, and a context menu opens. Select the first
item called “Edit properties”. A sub window appears, which should look like the one in fig.
3. The alternative for entering equations is to double click onto the equation.
You can now change the name of the dependent, the equation itself (which is “1” in the
example shown) and the name of the equation. If you do not want the result to be exported
into the data display tab, but temporarily need it for further calculations, select “no” in
the “Export value” cell.
3
Syntax of Measurement Expressions
Function names, variable names, and constant names are all case sensitive in measurement
expressions - it is distinguished between lowercase and uppercase letters such as ’a’ and
’A’.
Variable Names
User defined variable names consist of a letter, followed by any number of letters, digits,
or underscores.
The syntax of variable names created by the ”Qucs” simulator is as specified in table 1.
Please note that all voltages and currents in“Qucs”are peak values except the noise voltages
and currents which are rms values at 1Hz bandwidth.
4
Numbers
Numbers are written in conventional decimal way, with an optional decimal point between
the digits. For powers of ten, the familiar scientific notation with an ’e’ is used. In this way,
’1.234e6’ is an example for the real floating point number 1234000. Imaginary numbers
can be entered by a multiplication factor ’i’ or ’j’ (see also table 2). An example would be
’1+2*i’ or - if you want to leave out the multiplication sign - ’1+i2’.
Built-in constants
The constants which can be used within measurement expressions are given in table 2.
Operators
Operator Precedence Expressions are evaluated in the standard way, meaning from left
to right, unless there are parentheses. The priority of operators is also handled familiarly,
thus for example multiplication has precedence to addition. Table 3 specifies a sorted list
of all operators, the topmost having highest priority. Operators on the same line have the
same precedence.
After a simulation has run the results are stored in datasets. Usually, such a dataset is
a vector or a matrix, but may also be a real or complex scalar. For transient analysis,
this dataset contains voltage or current information over time, for Harmonic Balance it
5
Operator Name Example
() Parentheses, function call max(v)
ˆ Exponentiation 3ˆ4
* Multiplication 3*4
/ Division 3/4
% Modulo 4%3
+ Addition 3+4
- Subtraction 3-4
: Range operator 3:12
Syntax Explanation
m:n Range from index m to index n
:n Range up to index n
m: Range starting from index m
: No range limitations
This chapter introduces the basic syntax of the function descriptions and contains a cate-
gorical list of all available functions.
”Qucs” provides a rich set of functions, which can be used to generate and display new
datasets by function based evaluation of simulation results. Beside a large number of
mathematical standard functions such as square root (sqrt), exponential function (exp),
6
absolute value (abs), functions especially useful for calculation and transformation of elec-
tronic values are implemented. Examples for the latter would be the conversion from
Watts to dBm, the generation of noise circles in an amplifier design, or the conversion from
S-parameters to Y-parameters.
In the subsequent two chapters, each function is described using the following structure:
<Function Name>
Syntax
Arguments
Name, type, definition range and whether the argument is optional, are tabulated here. In
case of an optional parameter the default value is specified. “Type” is a list defining the
arguments allowed and may contain the following symbols:
Symbol Description
R Real number
C Complex number
Rn Vector consisting of n real elements
Cn Vector consisting of n complex elements
Rm×n Real matrix consisting of m rows and n columns
Cm×n Complex matrix consisting of m rows and n columns
Rm×n×p Vector of p real m × n matrices
Cm×n×p Vector of p complex m × n matrices
“Definition range” specifies the allowed range. Each range is introduced by a bracket, either
“[ ” or “] ”, meaning that the following start value of the range is either included or excluded.
The start value is separated from the end value by a comma. Then the end value follows,
7
finished by a bracket again, either “[” or “]”. The first bracket mentioned means “excluding
the end value”, the second means “including”.
If a range is given for a complex number, this specifies the real or imaginary value of that
number. If a range is given for a real or complex vector or matrix, this specifies the real
or imaginary value of each element of that vector or matrix. The symbols mean “includes
listed value” and “excludes listed value”.
Description
Gives a more detailed description on what the function does and what it returns. In case
some background knowledge is presented.
Examples
See also
Shows links to related functions. A mouse click onto the desired link leads to an immediate
jump to that function.
This compilation shows all “Qucs” functions sorted by category. Please click on the desired
function to go to its detailed description.
Math Functions
8
Vectors and Matrices: Basic Matrix Functions
9
Elementary Mathematical Functions: Trigonometry
10
Elementary Mathematical Functions: Special Mathematical Functions
11
Data Analysis: Signal Processing
Electronics Functions
Unit Conversion
rtoswr() ... Converts reflection coefficient to voltage standing wave ratio (VSWR)
rtoy() ... Converts reflection coefficient to admittance
rtoz() ... Converts reflection coefficient to impedance
ytor() ... Converts admittance to reflection coefficient
ztor() ... Converts impedance to reflection coefficient
12
Amplifiers
GaCircle() ... Circle(s) with constant available power gain Ga in the source plane
GpCircle() ... Circle(s) with constant operating power gain Gp in the load plane
Mu() ... Mu stability factor of a two-port S-parameter matrix
Mu2() ... Mu’ stability factor of a two-port S-parameter matrix
NoiseCircle() ... Generates circle(s) with constant Noise Figure(s)
PlotVs() ... Returns a data item based upon vector or matrix vector with
dependency on a given vector
Rollet() ... Rollet stability factor of a two-port S-parameter matrix
StabCircleL() ... Stability circle in the load plane
StabCircleS() ... Stability circle in the source plane
Math Functions
Creation
eye()
Creates n x n identity matrix.
Syntax
y=eye(n)
Arguments
Description
13
1 0··· 0 0
0 1 0 ··· 0
.. ... ..
. 0 0 .
0 ··· 0 1 0
0 0 ··· 0 1
Example
1 0
y=eye(2) returns .
0 1
See also
14
linspace()
Creates a real vector with linearly spaced components.
Syntax
y=linspace(xs,xe,n)
Arguments
Description
This function creates a real vector with n linearly spaced components. The first component
is xs, the last one is xe.
Example
See also
logspace()
15
logspace()
Creates a real vector with logarithmically spaced components.
Syntax
y=logspace(xs,xe,n)
Arguments
Description
This function creates a real vector with n logarithmically spaced components. The first
component is xs, the last one is xe.
Example
See also
linspace()
16
Basic Matrix Functions
adjoint()
Adjoint matrix.
Syntax
Y=adjoint(X)
Arguments
Description
Example
3+j1 0
X=eye(2)*(3+i) returns . Then,
0 3+j1
3-j1 0
Y=adjoint(X) returns .
0 3-j1
See also
transpose(), conj()
17
array()
Read out single elements.
Syntax
The “array()” function is an implicit command. Thus normally the respective first expres-
sion (”preferred”) is used.
Arguments
Description
This function reads out real or complex vectors of matrices, matrices and vectors or strings.
Please refer to the following table for the return values:
18
Syntax Argument 1 Argument 2 Argument 3 Result
y=VM[i,j] V M = (xijk ) i∈N j∈N Vector
(xij1 , · · · , xijK )
y=M[i,j] M = (xij ) i∈N j∈N Number xij
y=VM[k] V M = (xijk ) k∈N Matrix
x11k · · · x1nk
.. ... ..
. .
xm1k · · · xmnk
y=v[i] v = (vi ) i∈N Number vi
y=v[xs:xe] v = (vi ) xs, . . . , xe Vector
(vxs , · · · , vxe )
y=v[i,xs:xe] v = (vi ) i∈N xs, . . . , xe Vector
(vxs , · · · , vxe )
y=v[xs:xe,j] v = (vi ) xs, . . . , xe xs, . . . , xe Vector
(vxs , · · · , vxe )
y=v[i,j] v = (vi ) i∈N xs, . . . , xe Vector
(vxs , · · · , vxe )
y=v[xs1:xe1, v = (vi ) xs1, . . . , xe1 xs2, . . . , xe2 Vector
xs2:xe2] (vxs , · · · , vxe )
y=s[i] s = (si ) i∈N Character si
Example
y=v[3] returns 2.
See also
19
det()
Determinant of a matrix.
Syntax
y=det(X)
Arguments
Description
Example
3 0
X=eye(2)*3 returns . Then,
0 3
y=det(X) returns 9.
See also
eye()
20
inverse()
Matrix inverse.
Syntax
Y=inverse(X)
Arguments
Description
This function inverts a quadratical n x n matrix X. The generated inverted matrix Y fulfills
the equation
Example
3 0
X=eye(2)*3 returns . Then,
0 3
0.333 0
Y=inverse(X) returns .
0 0.333
See also
21
transpose()
Matrix transpose.
Syntax
Y=transpose(X)
Arguments
Description
Example
3 0
X=eye(2)*3 returns . Then,
0 3
3 0
Y=transpose(X) returns .
0 3
See also
eye(), inverse()
22
Elementary Mathematical Functions
abs()
Absolute value.
Syntax
y=abs(x)
Arguments
Description
This function calculates the absolute value of a real or complex number, vector or matrix.
x f or x ≥ 0
For x ∈ R: y =
−x f or x < 0
√
For C 3 x := a + i b ∧ a, b ∈ R: y = a2 + b 2
For x being a vector or a matrix the two equations above are applied to the components
of x.
Examples
y=abs(-3) returns 3,
y=abs(-3+4*i) returns 5.
See also
23
angle()
Phase angle in radians of a complex number. Synonym for “arg”.
Syntax
y=angle(x)
See also
24
arg()
Phase angle in radians of a complex number.
Syntax
y=arg(x)
Arguments
Description
This function returns the phase angle in degrees of a real or complex number, vector or
matrix.
0 f or x ≥ 0
For x ∈ R: y =
π f or x < 0
For C 3 x := a + i b ∧ a, b ∈ R:
In this case the arctan() function returns values in radians. The result y of the phase
function is in the range [−π, +π]. For x being a vector or a matrix the two equations
above are applied to the components of x.
Examples
25
y=arg(-3) returns 3.14,
See also
26
conj()
Conjugate of a complex number.
Syntax
y=conj(x)
Arguments
Description
This function returns the conjugate of a real or complex number, vector or matrix.
For x ∈ R: y = x
For C 3 x := a + i b ∧ a, b ∈ R: y = a − i b
For x being a vector or a matrix the two equations above are applied to the components
of x.
Example
See also
27
deg2rad()
Converts phase from degrees into radians.
Syntax
y=deg2rad(x)
Arguments
Description
This function converts a real phase, a complex phase or a phase vector given in degrees
into radians.
π
For x ∈ R: y = x
180
π
For x∈ C : y = Re {x}
180
For x being a vector the two equations above are applied to the components of x.
Example
See also
28
imag()
Imaginary value of a complex number.
Syntax
y=imag(x)
Arguments
Description
This function returns the imaginary value of a real or complex number, vector or matrix.
For x ∈ R: y = 0
For C 3 x := a + i b ∧ a, b ∈ R: y = b
For x being a vector or a matrix the two equations above are applied to the components
of x.
Example
y=imag(-3+4*i) returns 4.
See also
29
mag()
Magnitude of a complex number.
Syntax
y=mag(x)
Arguments
Description
This function calculates the magnitude (absolute value) of a real or complex number, vector
or matrix.
x f or x ≥ 0
For x ∈ R: y =
−x f or x < 0
√
For C 3 x := a + i b ∧ a, b ∈ R: y = a2 + b 2
For x being a vector or a matrix the two equations above are applied to the components
of x.
Examples
y=mag(-3) returns 3,
y=mag(-3+4*i) returns 5.
See also
30
norm()
Square of the absolute value of a vector.
Syntax
y=norm(x)
Arguments
Description
This function returns the square of the absolute value of a real or complex number, vector
or matrix.
For x ∈ R: y = x2
For C 3 x := a + i b ∧ a, b ∈ R: y = a2 + b2
For x being a vector or a matrix the two equations above are applied to the components
of x.
Example
See also
31
phase()
Phase angle in degrees of a complex number.
Syntax
y=phase(x)
Arguments
Description
This function returns the phase angle in degrees of a real or complex number, vector or
matrix.
0 f or x ≥ 0
For x ∈ R: y =
180 f or x < 0
For C 3 x := a + i b ∧ a, b ∈ R:
In this case the arctan() function returns values in degrees. The result y of the phase
function is in the range [−180, +180]. For x being a vector or a matrix the two equations
above are applied to the components of x.
Examples
32
y=phase(-3) returns 180,
See also
33
polar()
Transform from polar coordinates into complex number.
Syntax
c=polar(a,p)
Arguments
Description
This function transforms a point given in polar coordinates (amplitude a and phase p in
degrees) in the complex plane into the corresponding complex number:
Example
See also
abs(), mag(), norm(), real(), imag(), conj(), phase(), arg(), exp(), cos(), sin()
34
rad2deg()
Converts phase from degrees into radians.
Syntax
y=rad2deg(x)
Arguments
Description
This function converts a real phase, a complex phase or a phase vector given in radians
into degrees.
180
For x ∈ R: y = x
π
180
For x∈ C : y = Re {x}
π
For x being a vector the two equations above are applied to the components of x.
Example
See also
35
real()
Real value of a complex number.
Syntax
y=real(x)
Arguments
Description
This function returns the real value of a real or complex number, vector or matrix.
For x ∈ R: y = x
For C 3 x := a + i b ∧ a, b ∈ R: y = a
For x being a vector or a matrix the two equations above are applied to the components
of x.
Example
See also
36
signum()
Signum function.
Syntax
y=signum(x)
Arguments
Description
( x
f or x 6= 0
For x ∈ C: y = |x|
0 f or x = 0
For x being a vector the two equations above are applied to the components of x.
Examples
See also
abs(), sign()
37
sign()
Sign function.
Syntax
y=sign(x)
Arguments
Description
( x
f or x 6= 0
For x ∈ C: y = |x|
1 f or x = 0
For x being a vector the two equations above are applied to the components of x.
Examples
See also
abs(), signum()
38
sqr()
Square of a number.
Syntax
y=sqr(x)
Arguments
Description
This function calculates the square root of a real or complex number or vector.
y = x2
For x being a vector the two equations above are applied to the components of x.
Examples
See also
sqrt()
39
sqrt()
Square root.
Syntax
y=sqrt(x)
Arguments
Description
This function calculates the square root of a real or complex number or vector.
√
For x ∈ R: y = √x f or x ≥ 0
i −x f or x < 0
p ϕ
For x ∈ C: y = |x| ei 2 with ϕ = arg (x)
For x being a vector the two equations above are applied to the components of x.
Examples
See also
sqr()
40
unwrap()
Unwraps a phase vector in radians.
Syntax
y=unwrap(x)
y=unwrap(x, t)
Arguments
Description
This function unwraps a phase vector x to avoid phase jumps. If two consecutive values
of x differ by more than tolerance t, ∓2π(depending on the sign of the difference) is added
to the current element of x. The predefined value of the optional parameter t is π.
Examples
See also
41
Exponential and Logarithmic Functions
exp()
Exponential function.
Syntax
y=exp(x)
Arguments
Description
This function calculates the exponential function of a real or complex number or vector.
For x ∈ R: y = ex
For x being a vector the two equations above are applied to the components of x.
Examples
See also
42
log10()
Decimal logarithm.
Syntax
y=log10(x)
Arguments
Description
This function calculates the principal value of the decimal logarithm (base 10) of a real or
complex number or vector.
ln (x)
f or x > 0
ln (10)
For x ∈ R: y = ln (−x) π
+i f or x < 0
ln (10) ln (10)
For x being a vector the two equations above are applied to the components of x.
Examples
See also
43
log2()
Binary logarithm.
Syntax
y=log2(x)
Arguments
Description
This function calculates the principal value of the binary logarithm (base 2) of a real or
complex number or vector.
ln (x)
f or x > 0
ln (2)
For x ∈ R: y = ln (−x) π
+i f or x < 0
ln (2) ln (2)
For x being a vector the two equations above are applied to the components of x.
Examples
See also
44
ln()
Natural logarithm (base e).
Syntax
y=ln(x)
Arguments
Description
This function calculates the principal value of the natural logarithm (base e) of a real or
complex number or vector.
ln (x) f or x > 0
For x ∈ R: y =
ln (−x) f or x < 0
For x being a vector the two equations above are applied to the components of x.
Examples
See also
45
Trigonometry
cos()
Cosine function.
Syntax
y=cos(x)
Arguments
Description
1
For x ∈ C: y = 2
(exp (i x) + exp (−i x))
For x being a vector the two equations above are applied to the components of x.
Examples
See also
46
cosec()
Cosecant.
Syntax
y=cosec(x)
Arguments
Description
1
y = cosec x =
sin x
Example
See also
sin(), sec()
47
cot()
Cotangent function.
Syntax
y=cot(x)
Arguments
Description
1
For x ∈ R: y = with y ∈ [−∞, +∞]
tan (x)
!
exp (i x)2 + 1
For x ∈ C: y = i
exp (i x)2 − 1
For x being a vector the two equations above are applied to the components of x.
Examples
See also
48
sec()
Secant.
Syntax
y=sec(x)
Arguments
Description
1
y =sec x=
cos x
Example
y=sec(0) returns 1.
See also
cos(), cosec()
49
sin()
Sine function.
Syntax
y=sin(x)
Arguments
Description
For x being a vector the two equations above are applied to the components of x.
Examples
See also
50
tan()
Tangent function.
Syntax
y=tan(x)
Arguments
Description
For x being a vector the two equations above are applied to the components of x.
Examples
See also
51
Inverse Trigonometric Functions
arccos()
Arc cosine (also known as “inverse cosine”).
Syntax
y=arccos(x)
Arguments
Description
This function calculates principal value of the the arc cosine of a real or complex number
or vector.
For x being a vector the two equations above are applied to the components of x.
Examples
See also
52
arccot()
Arc cotangent.
Syntax
y=arctan(x)
Arguments
Description
This function calculates the principal value of the arc cotangent of a real or complex number
or vector.
For x being a vector the two equations above are applied to the components of x.
Examples
See also
53
arcsin()
Arc sine (also known as “inverse sine”).
Syntax
y=arcsin(x)
Arguments
Description
This function calculates the principal value of the arc sine of a real or complex number or
vector.
√
For x ∈ C: y = −i ln i x + 1 − x2
For x being a vector the two equations above are applied to the components of x.
Examples
See also
54
arctan()
Arc tangent (also known as “inverse tangent”).
Syntax
z=arctan(x)
z=arctan(y,x)
Arguments
Description
For the first syntax ( z =arctan(x ) ), this function calculates the principal value of the arc
tangent of a real or complex number or vector.
1 2i
For x ∈ C: y = − i ln −1
2 x+i
For x being a vector the two equations above are applied to the components of x.
z = ± arctan (y/x)
(with the arctan() function defined above) is evaluated. The sign of z is determined by
+ f or Re {x} > 0
sign(z)= .
− f or Re {x} > 0
Note that for the second syntax the case x = y = 0 is not defined.
55
Examples
See also
56
Hyperbolic Functions
cosh()
Hyperbolic cosine.
Syntax
y=cosh(x)
Arguments
Description
This function calculates the hyperbolic cosine of a real or complex number or vector.
y = 12 (ex + e−x )
Examples
See also
57
cosech()
Hyperbolic cosecant.
Syntax
y=cosech(x)
Arguments
Description
This function calculates the hyperbolic cosecant of a real or complex number or vector.
1
y=
sinh x
Examples
See also
58
coth()
Hyperbolic cotangent.
Syntax
y=coth(x)
Arguments
Description
This function calculates the hyperbolic cotangent of a real or complex number or vector.
1 ex + e−x
y= = x
tanh x e − e−x
Examples
See also
59
sech()
Hyperbolic secant.
Syntax
y=sech(x)
Arguments
Description
This function calculates the hyperbolic secant of a real or complex number or vector.
1
y=
cosh x
Examples
See also
60
sinh()
Hyperbolic sine.
Syntax
y=sinh(x)
Arguments
Description
This function calculates the hyperbolic sine of a real or complex number or vector.
y = 12 (ex − e−x )
Examples
See also
61
tanh()
Hyperbolic tangent.
Syntax
y=tanh(x)
Arguments
Description
This function calculates the hyperbolic tangent of a real or complex number or vector.
ex − e−x
y=
ex + e−x
Examples
See also
62
Inverse Hyperbolic Functions
arcosh()
Hyperbolic area cosine.
Syntax
y=arcosh(x)
Arguments
Description
This function calculates the hyperbolic area cosine of a real or complex number or vector,
which is the inverse function to the “cosh” function.
√
y = arcosh x = ln x + x2 − 1
Examples
y=arcosh(1) returns 0,
See also
63
arcoth()
Hyperbolic area cotangent.
Syntax
y=arcoth(x)
Arguments
Description
This function calculates the hyperbolic area cotangent of a real or complex number or
vector, which is the inverse function to the “cotanh” function.
1 x+1
y = arcoth x = ln
2 x−1
Examples
See also
64
arsinh()
Hyperbolic area sine.
Syntax
y=arsinh(x)
Arguments
Description
This function calculates the hyperbolic area sine of a real or complex number or vector,
which is the inverse function to the “sinh” function.
√
y = arsinh x = ln x + x2 + 1
Examples
See also
65
artanh()
Hyperbolic area tangent.
Syntax
y=artanh(x)
Arguments
Description
This function calculates the hyperbolic area tangent of a real or complex number or vector,
which is the inverse function to the “tanh” function.
1 1+x
y = artanh x = ln
2 1−x
Examples
y=artanh(0) returns 0,
See also
66
Rounding
ceil()
Round to the next higher integer.
Syntax
y=ceil(x)
Arguments
Description
This function rounds a real number x to the next higher integer value.
If x is a complex number both real part and imaginary part are rounded. For x being a
vector the operation above is applied to the components of x.
Examples
See also
67
fix()
Truncate decimal places from real number.
Syntax
y=fix(x)
Arguments
Description
This function truncates the decimal places from a real number x and returns an integer.
If x is a complex number both real part and imaginary part are rounded. For x being a
vector the operation above is applied to the components of x.
Examples
See also
68
floor()
Round to the next lower integer.
Syntax
y=floor(x)
Arguments
Description
This function rounds a real number x to the next lower integer value.
If x is a complex number both real part and imaginary part are rounded. For x being a
vector the operation above is applied to the components of x.
Examples
See also
69
round()
Round to nearest integer.
Syntax
y=round(x)
Arguments
Description
If x is a complex number both real part and imaginary part are rounded. For x being a
vector the operation above is applied to the components of x.
Examples
See also
70
Special Mathematical Functions
besseli0()
Modified Bessel function of order zero.
Syntax
i0=besseli0(x)
Arguments
Description
This function evaluates the modified Bessel function of order zero of a real or complex
number or vector.
∞ x 2k
X
2
i0 (x) = J0 (i x) = ,
k=0
k! Γ (k + 1)
where J0 (x)is the Bessel function of order zero and Γ (x)denotes the gamma function.
Example
See also
besselj(), bessely()
71
besselj()
Bessel function of n-th order.
Syntax
jn=besselj(n,x)
Arguments
Description
This function evaluates the Bessel function of n-th order of a real or complex number or
vector.
∞ n+2k
X (−1)k x2
Jn (x) = ,
k=0
k! Γ (n + k + 1)
Example
See also
besseli0(), bessely()
72
bessely()
Bessel function of second kind and n-th order.
Syntax
yn=bessely(n,x)
Arguments
Description
This function evaluates the Bessel function of second kind and n-th order of a real or
complex number or vector.
where Jm (x)denotes the Bessel function of first kind and n-th order.
Example
See also
besseli0(), besselj()
73
erf()
Error function.
Syntax
y=erf(x)
Arguments
Description
This function evaluates the error function of a real or complex number or vector. For
x ∈ R,
Zx
2 2
y=√ e−t dt
π
0
If x is a complex number both real part and imaginary part are subjected to the equation
above. For x being a vector the equation is applied to the components of x.
Example
See also
74
erfc()
Complementary error function.
Syntax
y=erfc(x)
Arguments
Description
This function evaluates the complementary error function of a real or complex number or
vector. For x ∈ R,
Zx
2 2
y =1− √ e−t dt
π
0
If x is a complex number both real part and imaginary part are subjected to the equation
above. For x being a vector the equation is applied to the components of x.
Example
See also
75
erfinv()
Inverse error function.
Syntax
y=erfinv(x)
Arguments
Description
This function evaluates the inverse of the error function of a real or complex number or
vector. For −1 < x < 1,
y = erf −1 (x)
If x is a complex number both real part and imaginary part are subjected to the equation
above. For x being a vector the equation is applied to the components of x.
Example
See also
76
erfcinv()
Inverse complementary error function.
Syntax
y=erfcinv(x)
Arguments
Description
This function evaluates the inverse of the complementary error function of a real or complex
number or vector. For 0 < x < 2,
y = erfc−1 (x)
If x is a complex number both real part and imaginary part are subjected to the equation
above. For x being a vector the equation is applied to the components of x.
Example
See also
77
sinc()
Sinc function.
Syntax
y=sinc(x)
Arguments
Description
This function evaluates the sinc function of a real or complex number or vector.
sin x
(
f or x 6= 0
y= x
1 f or x = 0
Examples
See also
sin()
78
step()
Step function.
Syntax
y=step(x)
Arguments
Description
This function calculates the step function of a real or complex number or vector. For x ∈ R,
0 f or x < 0
y= 0.5 f or x = 0
1 f or x > 0
If x is a complex number both real part and imaginary part are subjected to the equation
above. For x being a vector the equation is applied to the components of x.
Example
y=step(0.5) returns 1.
See also
79
Data Analysis
Basic Statistics
avg()
Average of vector elements.
Syntax
y=avg(x)
Arguments
Description
This function returns the sum of the elements of a real or complex vector or range.
1P n
For x ∈Cn : y = xi , 1 ≤ i ≤ n (for vectors) or xs ≤ i ≤ xe (for ranges)
n i=1
Example
y=avg(linspace(1,3,10)) returns 2.
See also
80
cumavg()
Cumulative average of vector elements.
Syntax
y=cumavg(x)
Arguments
Description
This function returns the cumulative average of the elements of a real or complex vector.
1P k
For x ∈Cn : yk = xi , 1 ≤ k ≤ n
k i=1
Example
See also
81
max()
Maximum value in vector.
Syntax
y=max(x)
Arguments
Description
This function returns the maximum value of a real or complex vector or range.
+ f or |arg (xi )| ≤ π2
with sign
− else
Example
y=max(linspace(1,3,10)) returns 3.
See also
min(), abs()
82
min()
Minimum value in vector.
Syntax
y=min(x)
Arguments
Description
This function returns the minimum value of a real or complex vector or range.
+ f or |arg (xi )| ≤ π2
with sign
− else
Example
y=min(linspace(1,3,10)) returns 1.
See also
max(), abs()
83
rms()
Root Mean Square of vector elements.
Syntax
y=rms(x)
Arguments
Description
This function returns the rms (root mean square) value of the elements of a real or complex
vector. By application of the trapezoidal integration rule,
r n
1 P 1 for 2 ≤ i ≤ n − 1
n
for x ∈C : y = ai xi x∗i , 1 ≤ i ≤ n, ai = 1
n i=1 2
for i = 1 or i = n
Example
See also
84
runavg()
Running average of vector elements.
Syntax
y=runavg(x,m)
Arguments
Description
This function returns the running average over m elements of a real or complex vector.
1 k+m−1
For x ∈Cn : yk =
P
xi , 1 ≤ k ≤ n
m i=k
Example
See also
85
stddev()
Standard deviation of vector elements.
Syntax
y=stddev(x)
Arguments
Description
This function returns the stddev of the elements of a real or complex vector x.
p
For x ∈Cn : y = variance(x)
Example
See also
86
variance()
Variance of vector elements.
Syntax
y=variance(x)
Arguments
Description
This function returns the variance of the elements of a real or complex vector.
1 P n
For x ∈Cn : y = (xi − x)2 , where x denotes mean (average) value of x.
n − 1 i=1
Example
See also
87
Basic Operation
cumprod()
Cumulative product of vector elements.
Syntax
y=cumprod(x)
Arguments
Description
This function returns the cumulative product of the elements of a real or complex vector.
k
For x ∈Cn : yk =
Q
xi , 1 ≤ k ≤ n
i=1
Example
y=cumprod(linspace(1,3,3)) returns 1, 2, 6.
See also
88
cumsum()
Cumulative sum of vector elements.
Syntax
y=cumsum(x)
Arguments
Description
This function returns the cumulative sum of the elements of a real or complex vector.
Xk
n
For x ∈C : yk = xi , 1 ≤ k ≤ n
i=1
Example
y=cumsum(linspace(1,3,3)) returns 1, 3, 6.
See also
89
interpolate()
Equidistant spline interpolation of data vector.
Syntax
z=interpolate(y,t,m)
z=interpolate(y,t)
Arguments
Description
This function uses spline interpolation to interpolate between the points of a vector y(t).
If the number of samples n is not specified, a default value of n = 64 is assumed.
Example
z=interpolate(linspace(0,2,3)*linspace(0,2,3),linspace(0,2,3))
See also
sum(), prod()
90
4
2
000.5Interpolate11 5
.
.001 2
Figure 4: Interpolated curve
prod()
Product of vector elements.
Syntax
y=prod(x)
Arguments
Description
This function returns the product of the elements of a real or complex vector.
n
For x ∈Cn : y =
Q
xi
i=1
91
Example
See also
92
sum()
Sum of vector elements.
Syntax
y=sum(x)
Arguments
Description
This function returns the sum of the elements of a real or complex vector.
n
For x ∈Cn : y =
P
xi
i=1
Example
See also
93
xvalue()
Returns x-value which is associated with the y-value nearest to a specified
y-value in a given vector.
Syntax
x=xvalue(f,yval)
Arguments
Description
This function 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.
Example
x=xvalue(f,1).
See also
yvalue(), interpolate()
94
yvalue()
Returns y-value of a given vector which is located nearest to the specified
x-value.
Syntax
y=yvalue(f,xval)
Arguments
Description
This function 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.
Example
y=yvalue(f,1).
See also
xvalue(), interpolate()
95
Differentiation and Integration
diff()
Differentiate vector with respect to another vector.
Syntax
z=diff(y,x,n)
Arguments
Description
This function numerically differentiates a vector y with respect to a vector x. If the optional
integer parameter n is given, the n-th derivative is calculated. Differentiation is executed
for N=min(k,m) elements. For n=1,
1 yi − yi−1 yi+1 − yi
+ for N − 1 > i > 0
2 xi − xi−1 xi+1 − xi
∆yi yi+1 − yi
= for i = 0
∆xi xi+1 − xi
yi − yi−1
for i = N − 1
xi − xi−1
If n>1, the result of the differentiation above is assigned to y and the aforementioned
differentiation step is repeated until the number of those steps is equal to n.
Example
z=diff(linspace(1,3,3),linspace(2,3,3)) returns 2, 2, 2.
See also
96
integrate()
Integrate vector.
Syntax
z=integrate(y,h)
Arguments
Description
This function numerically integrates a vector x with respect to a differential h. The inte-
gration method is according to the trapez rule:
y yn
R 0
f (t) dt ≈ h + y1 + y2 + . . . + yn−1 +
2 2
Example
R3
Calculate an approximation of the integral t dt using 105 points:
1
z=integrate(linspace(1,3,105)*linspace(1,3,105),0.02) returns 4.
See also
97
Signal Processing
dft()
Discrete Fourier Transform.
Syntax
y=dft(v)
Arguments
Description
This function computes the Discrete Fourier Transform (DFT) of a vector v. The advantage
of this function compared to fft() is that the number n of components of v is arbitrary,
while for the latter n must be a power of 2. The drawbacks are that dft() is slower and
less accurate than fft().
Example
y
1
y=dft(linspace(1,1,7)) returns -1.59e-17+j1.59e-17
..
.
2.22e-16-j1.11e-16
Please note that in this example 7 points are used for the time vector v. Since 7 is not a
power of 2, the same expression used together with the fft() function would lead to wrong
results. Note also the rounding errors where “0” would be the correct value.
See also
98
fft()
Fast Fourier Transform.
Syntax
y=fft(v)
Arguments
Description
This function computes the Fast Fourier Transform (FFT) of a vector v. The number n of
components of v must be a power of 2.
Example
y
1
y=fft(linspace(1,1,8)) returns 0
..
.
0
See also
99
idft()
Inverse Discrete Fourier Transform.
Syntax
y=idft(v)
Arguments
Description
This function computes the Inverse Discrete Fourier Transform (IDFT) of a vector v. The
advantage of this function compared to ifft() is that the number n of components of v is
arbitrary, while for the latter n must be a power of 2. The drawbacks are that idft() is
slower and less accurate than ifft().
Example
y
7
y=idft(linspace(1,1,7)) returns -1.11e-16-j1.11e-16
..
.
1.55e-15+j7.77e-16
Please note that in this example 7 points are used for the spectrum vector v. Since 7 is
not a power of 2, the same expression used together with the ifft() function would lead to
wrong results. Note also the rounding errors where “0” would be the correct value.
See also
100
ifft()
Inverse Fast Fourier Transform.
Syntax
y=ifft(v)
Arguments
Description
This function computes the Inverse Fast Fourier Transform (IFFT) of a vector v. The
number n of components of v must be a power of 2.
Example
y
8
y=ifft(linspace(1,1,8)) returns 0
..
.
0
See also
101
Time2Freq()
Interpreted Discrete Fourier Transform.
Syntax
y=Time2Freq(v,t)
Arguments
Description
This function computes the Discrete Fourier Transform (DFT) of a vector v with respect
to a time vector t.
Example
y=Time2Freq(linspace(1,1,7),linspace(0,1,2)) returns
Frequency y
0 1
0.167 -1.59e-17+j1.59e-17
.. ..
. .
1 2.22e-16-j1.11e-16
Please note that in this example 7 points are used for the time vector v. Note also the
rounding errors at t>0, where “0” would be the correct value.
See also
102
Freq2Time()
Interpreted Inverse Discrete Fourier Transform.
Syntax
y=Freq2Time(v,f)
Arguments
Description
This function computes the Inverse Discrete Fourier Transform (IDFT) of a vector v with
respect to a frequency vector f.
Example
y=Freq2Time(linspace(1,1,7),linspace(0,1,2)) returns
Frequency y
0 7
0.167 -1.11e-16-j1.11e-16
.. ..
. .
1 1.55e-15+j7.77e-16
Please note that in this example 7 points are used for the spectrum vector v. Note also
the rounding errors at t>0, where “0” would be the correct value.
See also
103
kbd()
Kaiser-Bessel derived window.
Syntax
y=kbd(a,n)
y=kbd(a)
Arguments
Description
yn−k−1 = yk
n
for 0 ≤ k < 2
Example
y=kbd(0.1,4) returns .
See also
104
Electronics Functions
Unit Conversion
dB()
dB value.
Syntax
y=dB(x)
Arguments
Description
y = 20 log |x|
Example
See also
log10()
105
dbm()
Convert voltage to power in dBm.
Syntax
y=dBm(u,Z0)
y=dBm(u)
Arguments
Description
This function returns the corresponding dBm power of a real or complex voltage or vector
u. The impedance Z0 referred to is either specified or 50Ω.
|u|2
y = 10 log
Z0 0.001W
Example
See also
106
dbm2w()
Convert power in dBm to power in Watts.
Syntax
y=dBm2w(x)
Arguments
Description
This function converts the real or complex power or power vector, given in dBm, to the
corresponding power in Watts.
x
y = 0.001 10 10
Example
See also
dbm(), w2dbm()
107
w2dbm()
Convert power in Watts to power in dBm.
Syntax
y=w2dBm(x)
Arguments
Description
This function converts the real or complex power or power vector, given in Watts, to the
corresponding power in dBm.
x
y = 10 log
0.001W
Example
See also
108
Reflection Coefficients and VSWR
rtoswr()
Converts reflection coefficient to voltage standing wave ratio (VSWR).
Syntax
s=rtoswr(r)
Arguments
Description
For a real or complex reflection coefficient r, this function calculates the corresponding
voltage standing wave ratio (VSWR) s according to
1 + |r|
s=
1 − |r|
Examples
s=rtoswr(0) returns 1.
See also
109
rtoy()
Converts reflection coefficient to admittance.
Syntax
y=rtoy(r)
y=rtoy(r, Z0)
Arguments
Description
For a real or complex reflection coefficient r, this function calculates the corresponding
admittance y according to
1 1−r
y=
Z0 1 + r
Example
See also
110
rtoz()
Converts reflection coefficient to impedance.
Syntax
z=rtoz(r)
z=rtoz(r, Z0)
Arguments
Description
For a real or complex reflection coefficient r, this function calculates the corresponding
impedance Z according to
1−r
Z = Z0
1+r
Example
See also
111
ytor()
Converts admittance to reflection coefficient.
Syntax
r=ytor(Y)
r=ytor(Y, Z0)
Arguments
Description
For a real or complex admittance y, this function calculates the corresponding reflection
coefficient according to
1 − Y Z0
r=
1 + Y Z0
Often a dB measure is given for the reflection coefficient, the so called “return loss”:
Example
See also
112
ztor()
Converts impedance to reflection coefficient.
Syntax
r=ztor(Z)
r=ztor(Z, Z0)
Arguments
Description
For a real or complex impedance Z, this function calculates the corresponding reflection
coefficient according to
Z − Z0
r=
Z + Z0
Often a dB measure is given for the reflection coefficient, the so called “return loss”:
Example
See also
113
N-Port Matrix Conversions
stos()
Converts S-parameter matrix to S-parameter matrix with different reference
impedance(s).
Syntax
y=stos(S, Zref)
Arguments
Description
This function converts a real or complex scattering parameter matrix S into a scattering
matrix Y. S has a reference impedance Zref, whereas the created scattering matrix Y has
a reference impedance Z0.
Both Zref and Z0 can be real or complex numbers or vectors; in the latter case the function
operates on the elements of Zref and Z0.
Example
-0.241 0
S2=stos(eye(2)*0.1,50,100) returns .
0 -0.241
114
See also
115
stoy()
Converts S-parameter matrix to Y-parameter matrix.
Syntax
Y=stoy(S)
Y=stoy(S, Zref)
Arguments
Description
This function converts a real or complex scattering parameter matrix S into an admittance
matrix Y. S has a reference impedance Zref, which is assumed to be Zref = 50Ω if not
provided by the user.
Zref can be real or complex number or vector; in the latter case the function operates on
the elements of Zref.
Example
0.00818 0
Y=stoy(eye(2)*0.1,100) returns .
0 0.00818
See also
116
stoz()
Converts S-parameter matrix to Z-parameter matrix.
Syntax
Z=stoz(S)
Z=stoz(S, Zref)
Arguments
Description
This function converts a real or complex scattering parameter matrix S into an impedance
matrix Z. S has a reference impedance Zref, which is assumed to be Zref = 50Ω if not
provided by the user.
Zref can be real or complex number or vector; in the latter case the function operates on
the elements of Zref.
Example
122 0
Z=stoz(eye(2)*0.1,100) returns .
0 122
See also
117
twoport()
Converts a two-port matrix from one representation into another.
Syntax
Arguments
Description
This function converts a real or complex two-port matrix X from one representation into
another.
Example
Y1=eye(2)*0.1
10 0
Z1=twoport(Y1,’Y’,’Z’) returns .
0 10
See also
118
ytos()
Converts Y-parameter matrix to S-parameter matrix.
Syntax
S=ytos(Y)
S=ytos(Y, Z0)
Arguments
Description
This function converts a real or complex admittance matrix Y into a scattering parameter
matrix S. Y has a reference impedance Z0, which is assumed to be Z0 = 50Ω if not provided
by the user.
Z0 can be real or complex number or vector; in the latter case the function operates on
the elements of Z0.
Example
-0.818 0
S=ytos(eye(2)*0.1,100) returns .
0 -0.818
See also
119
ytoz()
Converts Y-parameter matrix to Z-parameter matrix.
Syntax
Z=ytoz(Y)
Arguments
Description
This function converts a real or complex admittance matrix Y into an impedance matrix
Z.
Example
10 0
Z=ytoz(eye(2)*0.1) returns .
0 10
See also
twoport(), ztoy()
120
ztos()
Converts Z-parameter matrix to S-parameter matrix.
Syntax
S=ztos(Z)
S=ztos(Z, Z0)
Arguments
Description
This function converts a real or complex impedance matrix Z into a scattering parameter
matrix S. Z has a reference impedance Z0, which is assumed to be Z0 = 50Ω if not provided
by the user.
Z0 can be real or complex number or vector; in the latter case the function operates on
the elements of Z0.
Example
-0.998 0
S=ztos(eye(2)*0.1,100) returns .
0 -0.998
See also
121
ztoy()
Converts Z-parameter matrix to Y-parameter matrix.
Syntax
Y=ztoy(Z)
Arguments
Description
This function converts a real or complex impedance matrix Z into an admittance matrix
Y.
Example
10 0
Y=ztoy(eye(2)*0.1) returns .
0 10
See also
twoport(), ytoz()
122
Amplifiers
GaCircle()
Circle(s) with constant available power gain Ga in the source plane.
Syntax
y=GaCircle(X,Ga,v)
y=GaCircle(X,Ga,n)
y=GaCircle(X,Ga)
Arguments
Description
This function generates the points of the circle of constant available power gain GA in
the complex source plane (rS ) of an amplifier. The amplifier is described by a two-port
S-parameter matrix S. Radius r and center c of this circle are calculated as follows:
q
1 − 2 · K · gA · |S12 S21 | + gA2 · |S12 S21 |2 ∗
gA (S11 − S22 ∆∗ )
r= and c = ,
1 + gA · |S11 |2 − |∆|2 1 + gA |S11 |2 − |∆|2
GA
where gA = and K Rollet stability factor. ∆ denotes determinant of S.
|S21 |2
The points of the circle can be specified by the angle vector v, where the angle must be given
in degrees. Another possibility is to specify the number n of angular equally distributed
points around the circle. If no additional argument to X is given, 64 points are taken. The
123
available power gain can also be specified in a vector Ga, leading to the generation of m
circles, where m is the size of Ga.
Example
v=GaCircle(S)
See also
GpCircle(), Rollet()
124
GpCircle()
Circle(s) with constant operating power gain Gp in the load plane.
Syntax
y=GpCircle(X,Gp,v)
y=GpCircle(X,Gp,n)
y=GpCircle(X,Gp)
Arguments
Description
This function generates the points of the circle of constant operating power gain GP in
the complex load plane (rL ) of an amplifier. The amplifier is described by a two-port
S-parameter matrix S. Radius r and center c of this circle are calculated as follows:
q
1 − 2 · K · gP · |S12 S21 | + gP2 · |S12 S21 |2 ∗
gA (S22 − S11 ∆∗ )
r= and c = ,
1 + gP · |S22 |2 − |∆|2 1 + gP |S22 |2 − |∆|2
GP
where gA = and K Rollet stability factor. ∆ denotes determinant of S.
|S21 |2
The points of the circle can be specified by the angle vector v, where the angle must be given
in degrees. Another possibility is to specify the number n of angular equally distributed
points around the circle. If no additional argument to X is given, 64 points are taken. The
available power gain can also be specified in a vector Gp, leading to the generation of m
circles, where m is the size of Gp.
125
Example
v=GpCircle(S)
See also
GaCircle(), Rollet()
126
Mu()
Mu stability factor of a two-port S-parameter matrix.
Syntax
y=Mu(S)
Arguments
Description
This function returns the Mu stability factor µ of an amplifier being described by a two-port
S-parameter matrix S :
1 − |S11 |2
µ= ∗
|S22 − S11 ∆| + |S21 S12 |
∆ denotes determinant of S.
For S being a vector of matrices the equation above is applied to the sub-matrices of S.
Example
m=Mu(S)
See also
127
Mu2()
Mu’ stability factor of a two-port S-parameter matrix.
Syntax
y=Mu2(S)
Arguments
Description
This function returns the Mu’ stability factor µ0 of an amplifier being described by a two-
port S-parameter matrix S :
0 1 − |S22 |2
µ = ∗
|S11 − S22 ∆| + |S21 S12 |
∆ denotes determinant of S.
For S being a vector of matrices the equation above is applied to the sub-matrices of S.
Example
m=Mu2(S)
See also
128
NoiseCircle()
Generates circle(s) with constant Noise Figure(s).
Syntax
y=NoiseCircle(Sopt,Fmin,Rn,F,v)
y=NoiseCircle(Sopt,Fmin,Rn,F,n)
y=NoiseCircle(Sopt,Fmin,Rn,F)
Arguments
Description
This function generates the points of the circle of constant Noise Figure (NF) F in the
complex source plane (rS ) of an amplifier. Generally, the amplifier has its minimum NF
Fmin , if the source reflection coefficient rS = Sopt (noise matching). Note that this state
with optimum source reflection coefficient Sopt is different from power matching ! Thus
power gain under noise matching is lower than the maximum obtainable gain. The values
of Sopt , Fmin and the normalised equivalent noise resistance Rn /Z0 can be usually taken from
the data sheet of the amplifier.
The points of the circle can be specified by the angle vector v, where the angle must be given
in degrees. Another possibility is to specify the number n of angular equally distributed
points around the circle. If no additional argument to X is given, 64 points are taken.
129
Please also refer to “Qucs - Technical Papers”, chapter 2.2.
Example
v=NoiseCircle(Sopt,Fmin,Rn,F)
See also
GaCircle(), GpCircle()
130
PlotVs()
Returns a data item based upon vector or matrix vector with dependency on
a given vector.
Syntax
y=PlotVs(X, v)
Arguments
Description
This function returns a data item based upon a vector or matrix vector X with dependency
on a given vector v.
Example
PlotVs(Gain,frequency/1E9).
See also
131
Rollet()
Rollet stability factor of a two-port S-parameter matrix.
Syntax
y=Rollet(S)
Arguments
Description
This function returns the Rollet stability factor K of an amplifier being described by a
two-port S-parameter matrix S :
∆ denotes determinant of S.
For S being a vector of matrices the equation above is applied to the sub-matrices of S.
Example
K=Rollet(S)
See also
132
StabCircleL()
Stability circle in the load plane.
Syntax
y=StabCircleL(X)
y=StabCircleL(X,v)
y=StabCircleL(X,n)
Arguments
Description
This function generates the stability circle points in the complex load reflection coefficient
(rL ) plane of an amplifier. The amplifier is described by a two-port S-parameter matrix S.
Radius r and center c of this circle are calculated as follows:
∗
S21 S12 S22 − S11 · ∆∗
r= and c =
|S22 |2 − |∆|2 |S22 |2 − |∆|2
∆ denotes determinant of S.
The points of the circle can be specified by the angle vector v, where the angle must be given
in degrees. Another possibility is to specify the number n of angular equally distributed
points around the circle. If no additional argument to X is given, 64 points are taken.
If the center of the rL plane lies within this circle and |S11 | ≤ 1 then the circuit is stable
for all reflection coefficients inside the circle. If the center of the rL plane lies outside the
circle and |S11 | ≤ 1 then the circuit is stable for all reflection coefficients outside the circle
(please also refer to “Qucs - Technical Papers”, chapter 1.5).
133
Example
v=StabCircleL(S)
See also
134
StabCircleS()
Stability circle in the source plane.
Syntax
y=StabCircleS(X)
y=StabCircleS(X,v)
y=StabCircleS(X,n)
Arguments
Description
This function generates the stability circle points in the complex source reflection coefficient
(rS ) plane of an amplifier. The amplifier is described by a two-port S-parameter matrix S.
Radius r and center c of this circle are calculated as follows:
∗
S21 S12 S11 − S22 · ∆∗
r= and c =
|S11 |2 − |∆|2 |S11 |2 − |∆|2
∆ denotes determinant of S.
The points of the circle can be specified by the angle vector v, where the angle must be given
in degrees. Another possibility is to specify the number n of angular equally distributed
points around the circle. If no additional argument to X is given, 64 points are taken.
If the center of the rS plane lies within this circle and |S22 | ≤ 1 then the circuit is stable
for all reflection coefficients inside the circle. If the center of the rS plane lies outside the
circle and |S22 | ≤ 1 then the circuit is stable for all reflection coefficients outside the circle
(please also refer to “Qucs - Technical Papers”, chapter 1.5).
135
Example
v=StabCircleS(S)
See also
136
Index
A D
besseli0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 F
besselj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 fft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
bessely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 fix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
C floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Freq2Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
ceil. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
conj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 G
cos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 GaCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
cosec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 GpCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
cosech. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58
cosh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 I
cot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
coth. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 idft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
cumavg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 ifft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
cumprod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 imag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
cumsum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 integrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
interpolate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
137
inverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 S
K sec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
sech . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
kbd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
L signum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
sin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
linspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 sinc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
ln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 sinh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
log10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 sqr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
log2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 sqrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
logspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 StabCircleL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
StabCircleS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
M stddev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
mag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
stos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
stoy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
stoz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Mu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Mu2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
T
N
tan. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
NoiseCircle. . . . . . . . . . . . . . . . . . . . . . . . . . . . .129
tanh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
norm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Time2Freq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
P transpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
twoport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
PlotVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 U
polar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
unwrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
prod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
V
R
variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
rad2deg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
real . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 W
rms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Rollet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 w2dbm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
round . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
rtoswr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 X
rtoy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 xvalue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94
rtoz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
runavg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Y
ytor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
138
ytos. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119
ytoz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
yvalue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
ztor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
ztos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
ztoy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
139