1
Appendix SD
Computer Aids: M
ATLAB
, and PSpice
SD.1 MATLAB
M
ATLAB (Matrix Laboratory) from The Mathworks, Inc., Natick, Massachusetts, is
a powerful software that is very popular for technical computing. It is a programming
language that additionally provides an interactive environment for using the language.
The strength of MATLAB is partly due to its ability to handle arrays and matrices in its
commands, which allows highly compact code. For example,
A
and
B
may be two
arrays of a thousand elements each. The single command
A*B
produces an array of a
thousand elements, each of which is the product of the corresponding elements of
A
and
B.
MATLAB has a number of add-in modules, referred to as
toolboxes
, for
specialized applications. One of these toolboxes, SIMULINK, has a user-friendly
graphical interface that can be used for the dynamic simulation of linear and nonlinear
systems, both continuous in time and discrete. For additional information on MATLAB and
its toolboxes, the reader is referred to the Mathworks website at www.mathworks.com
.
The use of MATLAB in this book is restricted to a number of commands and to
plotting graphs. This section provides a quick reference for MATLAB commands that are
commonly used in solving circuit problems and for plotting results. For additional, and
more detailed, information, the reader is referred to the MATLAB manuals or the many
textbooks available on the subject (see Bibliography).
Useful Commands
Polynomials
In MATLAB, polynomials are represented by row vectors, i.e., horizontal one-
dimensional arrays, consisting of coefficients of the independent variable ordered in
descending powers, the last coefficient being the constant term (zero power).
conv(a,b)
computes the product of two polynomials specified by the coefficient
arrays
a
and
b
and returns the coefficient array of the product polynomial
of length equal to (length
a
)
×
(length
b) –
1.
[quotient,remainder] = deconv(num,den)
computes the result of dividing two polynomials
specified by the arrays of coefficient
num
and
den
and returns the arrays
of coefficients of the quotient and remainder polynomials.