## Saturday, September 28, 2013

### A short tutorial of nonlinear circuit theory - part 2

In a previous post, we look at Kirchoff's laws and device constituency relations to derive state equations of an electrical circuit.  Today we will look at some simple circuits and their corresponding state equations.  The simplest dynamic circuit must have at least one capacitor (or inductor).  Let us consider a circuit with one linear capacitor and one nonlinear resistor.

#### Case 1: Assume that the resistor is voltage-controlled ($i = g(v)$)

The state equations can then be written as

\begin{equation} \frac{dq}{dt} = -g(v) = -g(q/C) \end{equation}

The trajectories can be visualized on the dynamic route, where we plot $\frac{dq}{dt}$ against $q$ and the arrows indicate how the trajectory will evolve:

#### Case 2: assume that the resistor is current controlled ($v = f(i)$).

We have $v = f(i) = f(-dq/dt)$.  Since $v = q/C$ we get $q = Cf(-dq/dt)$.  Using the dynamic route interpretation and depending on the shape of $f$, it is possible to find impasse points, where the trajectory does not know what to do.

How do we resolve such nonphysical situations?  By adding parasitic elements. Suppose we add a parasitic inductor L in series to the nonlinear resistor.

The resulting state equations will be given by: $\begin{array}{lcl}\frac{dq}{dt} & = & i_L = \frac{\phi}{L} \\ \frac{d\phi}{dt} & = & v_L = v_R - v_C = f(i_R) - q/c = f(\phi/L) - q/c \end{array}$

By introducing the variable $i_C = -i_L = -\phi/L$ we get the state equations: $\begin{array}{lcl}\frac{dq}{dt} & = & i_C \\ \frac{di_C}{dt} & = & -\frac{1}{L}(q/C - f(-i_C)) \end{array}$ By drawing the phase portrait, we see that at the curve $q = Cf(-i_C)$, $di_C/dt = 0$. In fact, we have an oscillator.

For the nonlinear resistor with a constituency relation as shown above, the existence of the limit cycle can be proved more rigorously by using the Poincaré -Bendixson theorem and the fact that the system has a bounded trapping region and a single equilibrium point that is unstable.

For $f$ an odd function, a second order system in this form is a Liénard equation  and the Levinson-Smith theorem  allows us to prove the existence of a stable limit cycle when the nonlinear resistor is of a certain form:

Theorem [Levinson-Smith 1942]: Consider the second order equations
$\begin{array}{lcl} dx/dt & = & y - F(x) \\ dy/dt & = & -g(x) \end{array}$ Suppose that
• $F$ is an odd $C^1$ function (i.e. $F(-x) = -F(x)$),
• $g$ is an odd $C^0$ function with $xg(x)>0$ for all $x\neq 0$,
• There is a constant $a>0$ such that $F(x) < 0$ on $0 < x < a$, $F(x) > 0$ on $x > a$, and $F'(x) > 0$ on $x>a$,
• $\int_0^x g(s)ds \rightarrow\infty$ as $|x|\rightarrow \infty$ and $F(x) \rightarrow\infty$ as $x\rightarrow \infty$.
Then there is a unique stable limit cycle around the origin in the system.

Note that our circuit above satisfies the hypothesis of the Levinson-Smith theorem if our nonlinear resistor has the form $v = f(i)$ where $f$ is a cubic polynomial of the form $x^3-ax$ for $a>0$.  In particular, we get exactly the Van der Pol equation $x'' + \alpha (x^2-1)x' + x = 0$ , an equation used to model oscillations occurring in a circuit involving vacuum tubes.

Another condition for guaranteeing the existence of a unique periodic solution is the following result :

Theorem: Consider the second order equations
$\begin{array}{lcl} dx/dt & = & y - F(x) \\ dy/dt & = & -g(x) \end{array}$ Suppose that
• $F$ is an odd $C^1$ function and is zero only at $x=0$,$x=a$ and $x=-a$ for some $a>0$,
• $F(x) \rightarrow \infty$ monotonically as $x\rightarrow \infty$ for $x >a$.
• $g$ is an odd $C^0$ function with $xg(x)>0$ for all $x\neq 0$,
Then the system has a unique periodic solution.

References:

 L. O. Chua, Introduction to nonlinear network theory, McGraw-Hill, 1969.
 L. O. Chua, C. A. Desoer, E. S. Kuh, Linear and nonlinear circuits, McGraw-Hill, 1987.
 L. O. Chua, Memristor-The missing circuit element, IEEE Transactions on Circuit Theory, Sept. 1971, vol. 18, no. 5, pp. 507-519.
 D. B. Strukov, G. S. Snider, D. R. Stewart1 & R. S. Williams, The missing memristor found, Nature 453, 1 May 2008, pp. 80-83.
 A. Liénard,  Étude des oscillations entretenues, Revue génér. de l'électr. 23, (1928), 901 - 902; 906 - 954.
 N. Levinson, O. Smith, A general equation for relaxation oscillations Duke Math. J. 9, (1942), 382 - 403.
 D. W. Jordan and P. Smith, Nonlinear Ordinary Differential Equations, Oxford University Press, 1977.
 Van der Pol, B. and Van der Mark, J., Frequency demultiplication, Nature, vol. 120, pp. 363-364, 1927.

## Sunday, September 15, 2013

### How to eat a meal

Many times my family and I face a dilemma when we go to a restaurant for a meal.  We would order a few dishes and when the food arrives we need to solve the following problem: there are several types of food on the table, each with a different preference in our mind. The question then is: which food should we eat first, which food should we eat second, etc.  My strategy is to eat my favorite food first.   My wife has a different philosophy; she saves the best for last.  I don't agree with her as I believe that your favorite food will not taste as good at the end of a meal, much more so than for food that you do not like as much anyway. Attempting to formulate this as a mathematical problem, we are essentially maximizing our enjoyment of the meal:
$$\max_S E(S)$$
where $F$ is the set of food items on the table, $S = (s_1,s_2,s_3,...)$ is the sequence of food to eat subject to the constraint that $s_i\in F$ and $E$ is your enjoyment of your meal based on the sequence $S$. The function $E$ can have very different forms depending on the individual and there are additional constraints depending on the situation.  Do you have to eat every items in $F$, or do you eat until you are full and put the leftovers in a doggie bag?  Is there a time constraint, in which case certain foods can be more easily digested and thus enjoyed more?  This problem can also be defined in more complicated ways by allowing you to eat part of one food item before eating part of another food item, etc.  $E(S)$ can simply be $E(S) = \sum_i E_i(s_i)$ where $E_i$ becomes smaller for larger $i$ as you are getting full, i.e. for all $x\in F$, $E_i(x)< E_j(x)$ if $i>j$. My argument at the beginning of this post was that $E_i$ decreases faster proportionally as $i$ increases for my favorite food than for foods I dislike.  To complicate things further, the ordering of the food items can influence your enjoyment not simply because your stomach is getting fuller, but could also depend on the flavor involved. Eating something sour might increase your appetite, whereas according to my wife eating something sweet after eating something salty might make you want to eat more salty foods. The use of sorbet to clean your palate between courses is another indication of this phenomenon. Similarly, eating protein or eating food that requires you to chew more will make you satisfied sooner. When presented with a plate of various fruits, she will eat the most sour fruits first, since she believes eating a sweet fruit first will make eating the sour fruit taste even more sour.
How different is the function $E$ different from person to person? Can we use our eating strategy $S$ over various meals to deduce the (presumably hidden) utility function $E$? (assuming that we are mentally optimizing $E$.)  Can optimizing $E$ be used to satisfy weight-loss goals?

## Saturday, September 14, 2013

### Fireworks and the speed of sound

We were watching a fireworks display during our spring break vacation this year, and my son remarked that there is a delay in the sound that we hear from the fireworks that we see in the air.  Since the fireworks typically go off quite high in the sky, the delay can be a second or more. (This is the same reason why we see lightning before hearing the thunder and we can use the delay to estimate how far the lightning strike is.) Recall that the speed of sound is about 340 m/s and the speed of light is so high (about 300 Mm/s) that the delay is essentially the time it takes for the sound to reach our ears. I have never thought of that before, mainly because in a fireworks display many fireworks are going off at different times close to each other and this masks the delay phenomenon. After he mentioned it, I notice it now every time I watch fireworks (and there are many opportunities during the year) and makes me realize that the perfectly synchronized sound effects you hear in a movie when they have a fireworks display may not be accurate.

## Saturday, September 7, 2013

### A short tutorial of nonlinear circuit theory - part 1

Today we look at applications of dynamical system theory in electrical engineering.  How is dynamical systems important for electrical engineering?  At the most fundamental level, electrical engineering deals with the physics of electricity.  We can describe electrical and magnetic phenomena via Maxwell's equations and the interaction of electrons, ions, and protons in physical matter.  Such mathematical models in general give us partial differential equations. However, if we describe things in such detail, the resulting equations will be so complicated that either it takes a long time to simulate the system or very little useful information can be extracted from the equations. Therefore in many electrical circuit applications, we will assume the lumped circuit approximation.  In a lumped circuit, electrical signals are propagated instantaneously through wires.  Exceptions to this approximation occur in applications such as high speed electronics and wireless electronics.  What follows is a brief introduction to nonlinear circuit theory. A more in depth study can be found in Ref.  and Ref. . In general an electrical circuit consists of devices connected with wires. Because of the lumped circuit approximation, the lengths of the wires are irrelevant. Each device can be thought of as a black box with n terminals, in which case it is called an n-terminal device.  For example, a resistor or a capacitor is a 2-terminal device and a transistor is a 3-terminal device.  Depending on our level of abstraction, a device could be a transistor, an amplifier consisting of many transistors, or a complicated device such as a microprocessor with billions of transistors.  Each  n -terminal device can be represented by a digraph with  n  branches connected at the datum node (Fig. 1).

Figure 1

Resistive and dynamic 2-terminal devices
In this short introduction we will only focus on electrical circuits composed of 2-terminal devices.  The two most important physical quantities in electrical circuits are voltages (v) and currents (i).  Two related quantities are the electrical flux linkage ($\phi$) and charge (q) which are related to  v  and  i  via:

$i = \frac{dq}{dt},\qquad v = \frac{d\phi}{dt}$

A 2-terminal device has two terminals and can be represented abstractly as a digraph with one branch and an associated reference direction:

A device which relates the voltage across it and the current through it is called a resistor.  In particular, it is described by the constituency relation $R(v,i) = 0$.  A device which relates the charge on it with the voltage across it is called a capacitor and is described by the constituency relation $C(q,v) = 0$.  A device which relates the flux linkage across it with the current through it is called an inductor and is described by $L(\phi,i) = 0$.  A resistor is called voltage-controlled if the constituency relation can be written as a function of voltage, i.e. $i = f(v)$.  Similar definitions exist for current-controlled resistors, charge-controlled capacitors etc. Resistors are static devices while capacitors and inductors are dynamic devices.  As we will see shortly, a circuit without dynamic devices has no dynamics.  The introduction of dynamic devices allow us to describe the behavior of the circuit as a continuous-time dynamical system.

What about a device which relates flux linkage and charge via a relation $M(\phi, q) = 0$?  Such devices are called memristors (MEMory ResISTOR) as postulated by Leon Chua in 1971 (Ref. ). Even though such devices can be synthesized using transistors and amplifiers, an elementary implementation did not exist until Stan Williams and his team from HP developed memristors using titanium dioxide in 2008 (Ref. 4).

Kirchoff's Laws
A electrical circuit can be represented abstractly as a digraph with a branch current and branch voltage associated to each branch.  We assume that the circuit is connected, i.e. the corresponding digraph is (weakly) connected (though not necessarily strongly connected).  Consider a connected digraph with n nodes and branches.  Since the digraph is connected, $b\geq n-1$.  The node-edge incidence matrix (or just incidence matrix) associated to a digraph is an n by b matrix A such that $A_{jk} = 1$ if branch k leaves node j$A_{jk} = -1$ if branch k enters node j, and $0$ otherwise.

Kirchoff's laws describe the relationships which these currents and voltages need to satisfy due to physical constraints such as charge conservation.

Kirchoff's current law (KCL) states that the sum of the currents entering a node is equal to the sum of the currents leaving the node.  A moment's thought will convince you that this requirement for the j-th node corresponds to the product between the j-th row of A and the current vector i be equal to 0. Thus Kirchoff's current law can be stated as Ai = 0.

Theorem: the matrix A has rank n-1.

Proof: the i-th column of consist of exactly one entry 1 and one entry -1 corresponding to the nodes that branch i is connected to. Consider rows of with k. Suppose a linear combination of these equations with nonzero coefficients sums to zero. Since the graph is connected, there is a node m which is connected by a branch to a node in these nodes. The corresponding column in A has a 1 (or -1) in the  m-th row and a -1 (or 1) in a row belonging to the k  rows. Therefore a linear combination of these equations with nonzero coefficients cannot sums to zero. This show that the rank of A is at least n-1.  The sum of the rows of A is zero, so cannot be full rank, and thus the rank of A is exactly n-1. $\blacksquare$

Thus we can delete one row from without losing any information since this row is always a linear combination of the other rows.  In the following we assume that A is a n-1 by b matrix with rank n-1.

For a branch k which goes between nodes $j_1$ and $j_2$, Kirchoff's voltage law (KVL) states that the voltage $v_k$ across branck is equal to the difference $e_{j_1}-e_{j_2}$ where $e_{j}$ is the voltage between the j-th node and the datum node.  It is easy to see that Kirchoff's voltage law can be expressed as $A^T$e-v = 0 or $A^T$e = v

Thus $v$ is in the range of the matrix $A^T$.  Since $A^T$ has rank n-1, another way to say this is that v lies in a n-1-dimensional subspace of ${\Bbb R}^b$.  Thus we can also express KVL using the orthogonality conditon Bv = 0 where B is b-(n-1) by matrix.  One such matrix B  is the fundamental loop matrix and describes a set of b-(n-1) loops in the circuit from which all loops in the circuit can be derived.  This is another way to view KVL: the algebraic sum of branch voltages in a loop is 0.

The complete description of the electronic circuit can be given by KVL, KCL, the constituency relations of the elements and the defining equations $i = \frac{dq}{dt}$ and $v = \frac{d\phi}{dt}$.  This gives us a set of constrained differential equations which describes the system.  It is not always possible to obtain a set of ordinary differential equations.  In the case that we can, it will be given in the form

\begin{equation}\label{eqn:state_circuit} \begin{array}{lclr}
\frac{dq}{dt} & =& f_1(q,\phi) & \qquad \mbox{Eq.} (1)\\
\frac{d\phi}{dt} & = & f_2(q,\phi) & \end{array}
\end{equation}

where q is the charge vector corresponding to the charges of all the capacitors and $\phi$ is the flux vector corresponding to the flux of the inductors.  The state vector is $(q,\phi)$.  In the case where the capacitors and inductors are linear, we have q = Cv and $\phi = Li$, so for $C\neq 0$ and $L\neq 0$, we can also choose $(v,i)$ as the state vector.  This is more desirable since voltages and currents can be more easily measured.  Furthermore, this change of variables can be also be done if there is a diffeomorphism between q and v and between $\phi$ and i.  The system defined by (v,i) is topologically conjugate to Eq. (1) via the diffeomorphism.  The number of equations in Eq. (1) will correspond the the total number of capacitors and inductors since we only have 2-terminal capacitors and inductors.

When there are no dynamic elements the circuit is called a resistive circuit and the equations of the circuit are given by Ai=0, Bv = 0 and R(i,v) = 0.  This is a set of nonlinear equations, the solutions of which define the operating voltages and currents of the circuit.  There is no dynamics in this system. A solution of these equations is an operating point of the circuit and corresponds to the actual voltages and currents we observe in the circuit.

Now a circuit with more than one operating point presents somewhat of a problem.  What does the physical circuit choose as the operating point?  In practice, the circuit can be at different operating points depending on when or how you power on the system.  To resolve this problem we postulate that parasitic capacitances and inductors are present in parallel and series respectively which results in a dynamic circuit.  Consider the state equations (Eq. (1)).  The equilibrium points correspond to points when $dq/dt = 0$ for the capacitors and $d\phi/dt = 0$ for the inductors.  This corresponds to the capacitor currents equal to zero and inductor voltages equal to zero.  Thus we can replace capacitors by a open circuit and inductors by a short circuit which results in the original resistive circuit.

Thus the operating points of the resistive circuit corresponds to equilibrium points of the dynamic circuit and initial conditions play a role in what equilibrium point we will see at steady state (assuming that the state trajectory of the dynamic circuit does converge to an equilibrium point) which corresponds to the operating point we observe.

In part 2, we will look at some simple circuits and their corresponding state equations.
References:

 L. O. Chua, Introduction to nonlinear network theory, McGraw-Hill, 1969.
 L. O. Chua, C. A. Desoer, E. S. Kuh, Linear and nonlinear circuits, McGraw-Hill, 1987.
 L. O. Chua, Memristor-The missing circuit element, IEEE Transactions on Circuit Theory, Sept. 1971, vol. 18, no. 5, pp. 507-519.
 D. B. Strukov, G. S. Snider, D. R. Stewart1 & R. S. Williams, The missing memristor found, Nature 453, 1 May 2008, pp. 80-83.