# State Space model for three-loop circuit

How do I choose the least number of state variables for the following circuit? I started out by assuming currents $$i_{1}, i_{2}, i_{3}$$ in each of the loops and applied KVL, which fetched me three differential equations: $$i_{1} + 2\frac{di_{1}}{dt} - 2\frac{di_{2}}{dt} = v_{i}(t)$$ $$2\frac{di_{1}}{dt} - 3\frac{di_{2}}{dt} + \frac{di_{3}}{dt} = 3i_{2}$$ $$\frac{di_{2}}{dt} - \frac{di_{3}}{dt} - i_{3} = v_{o}(t)$$

But when it comes to choosing the state variables, while keeping the number to minimum, I am unable to proceed. Can anyone help me? • Show your work. – Eugene Sh. Aug 20 '18 at 14:34
• Added the differential equations. – MaxFrost Aug 20 '18 at 15:35

A good rule of thumb I picked up from some guy on YouTube, is to look at every element that stores energy in your system. In this case you have two inductors and one capacitor. Energy in inductors is calculated with the current flowing through them. \begin{equation} E = (1/2)i_L^2, \end{equation} Where as the energy in a capacitor is calculated with the voltage developed on the cap. \begin{equation} E = (1/2)v_c^2, \end{equation}

Following this the state equations would be \begin{equation} i_1,i_2,v_0 \end{equation} where the currents are for the first two loops from the left of the schematic. You have the added benefit that the voltage out at the capacitor is also a state.

Hope this Helps

The way this is generally done is to get the equations into a matrix form (or solve them).

$$\\dot{x} =A x+ Bu\$$

and since the state would be the loop currents, we have $$\[\dot{x}]_j=\frac{di}{dt}\$$

$$\\begin{bmatrix} \frac{di_1}{dt} \\ \frac{di_2}{dt} \\ \frac{di_3}{dt} \end{bmatrix}= A \begin{bmatrix} i_1 \\ i_2\\ i_3 \end{bmatrix}+ Bu\$$

The matrix coefficients are the same for fly speck or differential notation.

$$2\frac{di_{1}}{dt} - 2\frac{di_{2}}{dt} + 0\frac{di_{3}}{dt} = -i_{1} + 0i_{2} +0i_{3} +v_{i}(t)$$ $$2\frac{di_{1}}{dt} - 3\frac{di_{2}}{dt} + \frac{di_{3}}{dt} = 0i_{1}+ 3i_{2}+0i_{3}$$ $$0\frac{di_{1}}{dt} + \frac{di_{2}}{dt} - \frac{di_{3}}{dt} = 0i_{1}+0i_{2} + i_{3} + v_{o}(t)$$

You can represent a matrix form from the above equations:

$$\\begin{bmatrix} 2 & -2 & 0 \\ 2&-3&1 \\ 0&1&-1 \end{bmatrix}\dot{x}= \begin{bmatrix} -1& 0& 0 \\0&3&0 \\0 &0&1 \end{bmatrix}x+ \begin{bmatrix} v_{i}(t) \\ 0\\v_{o}(t) \end{bmatrix}\$$

You need to reduce the system of equations until you get this (all the differential equations are reduced, this form makes it easy to work with or use it for simulation), by using the inverse of the matrix

$$\ T = \begin{bmatrix} 2 & -2 & 0 \\ 2&-3&1 \\ 0&1&-1 \end{bmatrix}\$$

$$\\begin{bmatrix} 1 & 0 & 0 \\ 0&1&0 \\ 0&0&1 \end{bmatrix}\dot{x}= T^{-1} A x+ T^{-1} \begin{bmatrix} v_{i}(t) \\ 0\\v_{o}(t) \end{bmatrix}\$$

if you substituted the variables back in it would look like this:

$$\\begin{bmatrix} \frac{di_1}{dt} \\ \frac{di_2}{dt} \\ \frac{di_3}{dt} \end{bmatrix}= T^{-1} A \begin{bmatrix} i_1 \\ i_2\\ i_3 \end{bmatrix}+ T^{-1} \begin{bmatrix} v_{i}(t) \\ 0\\v_{o}(t) \end{bmatrix}\$$

The number of states required for a full rank state space model is the same as the number of distinct energy storage elements (i.e. distinct inductors and capacitors). Typically, the states are the currents through the inductors, and the voltages across the capacitors.

Let $$\\small x_1=\$$ current down through the 2 H inductor; $$\\small x_2=\$$ current down through the 1 H inductor; and $$\\small x_3=\$$ voltage across the capacitor (+ at top).

Nodal analysis gives,

$$\\hspace{60mm}\small 8\dot x_1 -\dot x_2=3v_i-3x_1\$$

$$\\hspace{60mm}\small 2\dot x_1 -4\dot x_2=3x_2-3x_3\$$

And, for the third differential equation, KVL on the right-hand LCR mesh gives,

$$\\hspace{60mm}\small \dot x_3=2\dot x_2-2x_3\$$

Solving for the state derivatives,

$$\\hspace{60mm}\small \dot x_1=\left(4v_i-4x_1-x_2+x_3 \right)/10\$$

$$\\hspace{60mm}\small \dot x_2=\left(2v_i-2x_1-8x_2+8x_3\right)/10\$$

$$\\hspace{60mm}\small \dot x_3=\left(4v_i-4x_1-16x_2-4x_3\right)/10\$$

which can be used to construct the state space equation,

$$\\hspace{60mm}\small\pmb{ \dot x}=\pmb{Ax}+\pmb{B}u\$$

For interest, the $$\\small\pmb{A}\$$ matrix is non-singular, and has eigenvalues,

$$\\hspace{60mm}\small \lambda_{1}\approx -0.36\$$

$$\\hspace{60mm}\small \lambda_{2,3}\approx -0.62\pm j1.13\$$