Professional Documents
Culture Documents
Computational Electronic Circuits
Computational Electronic Circuits
Sotoudeh Hamedi-Hagh
Computational Electronic
Circuits
Simulation and Analysis with MATLAB®
Sotoudeh Hamedi-Hagh
San Jose State University
San Jose, CA, USA
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland
AG 2022
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether
the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and
transmission or information storage and retrieval, electronic adaptation, computer software, or by
similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this
book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
To my dearest family
For their love and support
Preface
Writing a full-scale circuit simulator is a very intriguing and satisfying task, espe-
cially for students. In the process of writing a circuit simulator, students will better
understand and learn the circuit theory and analysis. These are the motivations that
prompt me to write this book. A circuit simulator has two main parts. The first part is
the generation of a graphical user interface for drawing circuits and interconnects.
This is called the schematic editor. The second part is translating the circuit into
codes that can be mathematically computed. This is called the circuit analyzer. Both
the graphical user interface and the computational engine are integrated into a
compiler called the circuit simulator. The compiler is written using a computer
programming language like C and includes an extensive library of different func-
tions that users can execute, such as moving a circuit component to a new location
and rotating it or creating netlist from the circuit and performing a specific simulation
followed by calculating some characteristics, such as the time-domain average of a
signal or the frequency-domain group delay of a voltage-gain transfer function.
Writing a compiler using a programming language is not in the scope of this
book. Instead, a versatile compiler such as MATLAB is used in this book in order to
show the generation of a circuit graphical user interface, translating the circuit into
codes that can be computationally calculated as well as creating a library of circuit
analysis functions. The generation of the graphical user interface and translating
circuits into netlists are demonstrated at the end of Chap. 1 after circuit components
and their characteristics are studied. Although the generation of a graphical user
interface is very fun and helpful for creating a circuit simulator, it is not essential in
learning circuit theories and analyses. As a result, this first part of the circuit
simulator is only studied in Chap. 1. The main emphasize in the remaining chapters
is to show how to create computational codes required by the second part of the
circuit simulator in order to analyze circuits and extract their characteristics.
The universal adaptability of computational codes is considered throughout his
book. As an example, instead of asking students to hand calculate the voltage-gain
transfer functions of different filters before plotting them using MATLAB, the
voltage-gain transfer functions for circuits with different number of nodes and
vii
viii Preface
configurations are automatically calculated using Cramer’s rules and Laplace expan-
sions applied to admittance matrices. As a result, the codes and the methods adopted
in this book can be used in a universal circuit simulator rather than a specific-task
simulation. Utilizing custom simulation functions such as calculating fast Fourier
transform and numerical analysis of systems of equations are also used throughout
this book instead of relying on pre-existing MATLAB functions, such as FFT or
solve commands. Most of the computational books in engineering topics use exten-
sive amounts of math that can easily force a reader to lose the comprehension and the
interest in the topic. While an extensive amount of simulation methods is covered in
this book, the amount of math is kept at a minimum level.
Circuit analysis can be done using nodal currents, mesh voltages, or both. Each
method if applied properly can analyze any kind of circuits. The nodal analysis based
on Kirchhoff’s current law is used throughout this book to analyze circuits. The
signal notations used in this book include presenting the instantaneous voltage and
current signals by “VTR” and “ITR” (capital letter followed by capital subscript), the
DC components of the signals by “vDC” and “iDC” (lowercase letter followed by
capital subscript), and presenting the AC components of the signals by “vac” and
“iac” (lowercase italic letter followed by lowercase subscript). In the absence of AC
signals in DC analysis, the DC and instantaneous signals become equal and the DC
voltages and currents might optionally be shown with the instantaneous signal
notation.
Circuit analysis is done using two distinct numerical and symbolic approaches.
Both methods are covered in this book. The numerical approach generates a
component-obscure result after each simulation but is very computer-memory effi-
cient because when multiple numbers are added, subtracted, multiplied, or divided
together, the result will be just a number. The symbolic approach generates a
component-visible result that shows how the circuit characteristic changes by vary-
ing each component but is very computer-memory inefficient because as different
symbolic variables are added, subtracted, multiplied, or divided together, the math-
ematical expressions expand in size. For small circuits or simple building blocks that
are studied in electronic courses, the symbolic analysis is advantageous in teaching
students how the circuits work. For large circuits, full symbolic analysis becomes
impractical and the numerical analysis becomes the only practical choice in creating
circuit simulators.
The modeling and characteristics of circuit components and creating circuits and
netlists are studied in Chap. 1. The DC analysis of linear and nonlinear circuits is
studied in Chap. 2. The calculation of inverse matrix, Laplace expansion, LU
decomposition, Gaussian elimination, and iterative methods such as conjugate
gradient, Gauss-Seidel, and Newton-Raphson are demonstrated in this chapter.
The transient analysis of linear and nonlinear circuits is studied in Chap. 3. The
calculation of finite difference and finite integrals, Laplace transforms, partial frac-
tion decomposition, and fast Fourier transform are demonstrated in this chapter. The
AC analysis of linearized circuits is studied in Chap. 4. The Cramer’s rules and
Laplace expansion, Taylor series expansion, node elimination, extraction of admit-
tance matrix and transfer functions, power gains, Y-, Z-, and S-parameters and their
Preface ix
conversions, poles and zeros, impulse and step responses, Bode, Nyquist and
Nichols plots, root locus and Smith charts are demonstrated in this chapter. The
noise analysis of linearized circuits is studied in Chap. 5. The transient and spectral
noise characteristics, noise matrices, noise transformation, input and output referred
noise calculations, noise factors, and noise and power tradeoff are demonstrated in
this chapter. Finally, the behavioral analysis of circuits where specific-task modeling
and algorithms are applied to different circuits in order to study their functionality is
studied in Chap. 6. An overview of chapter topics is listed in the following table.
AC
Ch. 4 Linearized s-domain Model Matrix Calculations Transfer Function Characteristics
Analysis
Noise
Ch. 5 Linearized s-domain Model Noise Matrix Calculations Noise Transformation
Analysis
Behavioral
Ch. 6 Block-Level Modeling Accuracy and Speed Tradeoff
Analysis
In contrary to the current computational methods for some engineering fields such
as electromagnetics and antenna where different methods and approaches are
required for simulating different open boundary or closed boundary systems, the
circuit analysis is very well structured and developed. For example, a single transient
analysis can solve any type of linear or nonlinear circuits with any type of compo-
nents with any number of nodes and meshes with any number and types of signal
sources. A simulation algorithm works for all types of circuits. All fundamental
knowledge and skills required for students in order to develop their own circuit
simulator are included in this book with the hope to make circuit and electronic
courses very enjoyable and memorable for all.
1 Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Numeric and Symbolic Analyses . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Finite Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Finite Difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Laplace Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4.1 Basic Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4.2 Multiplication and Convolution . . . . . . . . . . . . . . . . . . . 8
1.4.3 Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.4 Shifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.5 Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.6 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.7 Multiplication by Time . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.8 Conjugate Property . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.9 Initial and Final Values . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.10 Periodicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.5 Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.6 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.1 Ground . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.2 Short . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.3 Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.4 Ideal Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6.5 Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.6 Capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.6.7 Nonideal Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.6.8 Inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.6.9 Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.6.10 Nonideal Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1.6.11 Dependent Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.6.12 Diodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
xi
xii Contents
Q.6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Q.6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Q.6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Q.6.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Q.6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Q.6.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Q.6.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Q.6.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
List of Figures
xvii
xviii List of Figures
xxix
xxx List of Tables
Table 4.16 Initial guesses for the component values of the substrate
inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Table 4.17 Modeled Component Values of the Substrate Inductor . . . . . . . 323
Table 5.1 Samples of uniformly distributed x1(t) and normally
distributed x2(t) noise signals . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . 340
Table 5.2 Circuit parameters in Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Table 5.3 Circuit parameters in Example 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375