# Determining Number of states in State Space Modeling

I want to use state space modeling for representing the following circuit system. However, I am unable to decide the number of states. I am able to describe the system with a set of three equations. However, I am unable to form the matrix A with three states. Is the number of states three or more and how do I determine the number of states for circuits in general? (By the way, my outputs are currents through inductors and the voltage across the capacitor.)

simulate this circuit – Schematic created using CircuitLab

• this is not a discrete system, there's no discrete states. This circuit has uncountably infinite states. – Marcus Müller Jan 25 at 13:26
• Three states is correct. Show your attempt. – Chu Jan 25 at 14:02
• @MarcusMüller "states" can often refer to state variables in this context. I agree it's not the best term to use, but that seems to be what the asker means. – Hearth Jan 25 at 15:53
• @Hearth I'd say that the full state of this circuit, seeing it has only one voltage source, can be given by a single state variable, for example Vo, which defines all the currents and voltages in the circuit? – Marcus Müller Jan 25 at 16:06
• @MarcusMüller 'State' in this context refers to the state-space representation of circuits that are defined by systems of differential equations. The states are often taken as the voltage or current at each of the energy storage components in a system (i.e. inductor or capacitor). State space analysis is also widely used in MIMO control systems. – Chu Jan 25 at 18:53

Here is how to form a state-space model for this particular circuit (with matrix $$\A\$$ and three state variables):
As mentioned in one of Chu's comments, the state variables are often taken as the voltage or current at each of the energy storage components. In this circuit, you can choose the three state variables equal to the currents through the inductors $$\L_1\$$ and $$\L_2\$$ and the voltage across the capacitor $$\C_1\$$ (so the state variables are the same as your outputs). I assume that the input is the voltage source $$\V_1\$$. Your state-space model then looks like this: $$\frac{\mathrm{d}}{\mathrm{d}t} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = A \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} + B u$$ $$y = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix}$$ where $$\x_1\$$ is the current through inductor $$\L_1\$$, $$\x_2\$$ is the current through inductor $$\L_2\$$, $$\x_3\$$ is the voltage across capacitor $$\C_1\$$, and $$\u\$$ is the voltage $$\V_1\$$:
Denote a time-derivative with a dot on top of the variable (e.g. $$\\dot{x}_1 = \frac{\mathrm{d}}{\mathrm{d}t}x_1\$$). Then the voltage across inductor $$\L_1\$$ is equal to $$\L_1 \dot{x}_1\$$. Similarly, the voltage across inductor $$\L_2\$$ is equal to $$\L_2 \dot{x}_2\$$. The current through capacitor $$\C_1\$$ is equal to $$\C_1 \dot{x}_3\$$. Using Kirchhoff's current law and then writing out Kirchhoff's voltage law in each of the three loops (in blue in the picture) results in $$L_1 \dot{x}_1 = R_1 (x_1 + x_2 + C_1 \dot{x}_3) + u$$ $$L_2 \dot{x}_2 = L_1 \dot{x}_1 + R_2 (x_2 + C_1 \dot{x}_3)$$ $$L_2 \dot{x}_2 = x_3 + R_3 C_1 \dot{x}_3$$ You can interpret this as a set of three equations in the three unknowns $$\\dot{x}_1\$$, $$\\dot{x}_2\$$, and $$\\dot{x}_3\$$. Solving for them while assuming $$\R_3 - R_1 - R_2 \ne 0\$$ results in $$\dot{x}_1=\frac{1}{(R_3-R_1-R_2)L_1}((R_3-R_2)R_1 x_1 + R_1R_3 x_2 - R_1 x_3 + (R_3-R_2) u)$$ $$\dot{x}_2=\frac{1}{(R_3-R_1-R_2)L_2}(R_1R_3 x_1 + R_3(R_1+R_2) x_2 - (R_1+R_2) x_3 + R_3 u)$$ $$\dot{x}_3=\frac{1}{(R_3-R_1-R_2)C_1}(R_1 x_1 + (R_1+R_2) x_2 - x_3 + u)$$ Putting these equations in matrix form results in the state-space model with $$A = \frac{1}{K} \begin{bmatrix} (R_3-R_2)R_1L_2C_1 & R_1R_3L_2C_1 & -R_1L_2C_1 \\ R_1R_3L_1C_1 & R_3(R_1+R_2)L_1C_1 & -(R_1+R_2)L_1C_1 \\ R_1L_1L_2 & (R_1+R_2)L_1L_2 & -L_1L_2 \end{bmatrix}$$ and $$B = \frac{1}{K} \begin{bmatrix} (R_3-R_2)L_2C_1 \\ R_3L_1C_1 \\ L_1L_2 \end{bmatrix}$$ where $$\K=(R_3-R_1-R_2)L_1L_2C_1\$$.