I want to model an electrical circuit in the form of state-space equations, and I want to use Mathematica to solve the final equations, the circuit equations (from Kirchhoff's law) are shown below, and the upper point indicates differential calculation.
$$ \dot{x}=\frac{d x}{d t} $$
Kirchhoff's current law:
$$ \begin{array}{c}i+i_{3}+x_{3}-C_{2} \dot{x}_{2}=0 \\C_{1} \dot{x}_{1}+x_{3}+x_{4}=0 \\C_{2} \dot{x}_{2}+x_{4}-i_{4}=0\end{array} $$
Kirchhoff's voltage law:
$$ \begin{array}{c}-L_{1} \dot{x}_{3}+x_{1}+R_{1} i_{3}=0 \\-x_{1}+L_{2} \dot{x}_{4}+R_{2} i_{4}=0 \\L_{2} \dot{x}_{4}-L_{1} \dot{x}_{3}-x_{2}=0\end{array} $$
i.e.
eq1 = i + i3 + x3[t] - C2*x2'[t] == 0
eq2 = C1*x1'[t] + x3[t] + x4[t] == 0
eq3 = C2*x2'[t] + x4[t] - i4 == 0
eq4 = -L1*x3'[t] + x1[t] + R1*i3 == 0
eq5 = -x1[t] + L2*x4'[t] + R2*i4 == 0
eq6 = L2*x4'[t] - L1*x3'[t] - x2[t] == 0
I can only simplify these equations with pen and paper, like first I eliminate two variables i3 and i4
$$ \begin{array}{l}\dot{x}_{1}=-\frac{1}{C_{1}} x_{3}-\frac{1}{C_{1}} x_{4} \\R_{1} C_{2} \dot{x}_{2}-L_{1} \dot{x}_{3}=-x_{1}+R_{1} x_{3}+R_{1} i \\R_{2} C_{2} \dot{x}_{2}+L_{2} \dot{x}_{4}=x_{1}-R_{2} x_{4} \\-L_{1} \dot{x}_{3}+L_{2} \dot{x}_{4}=x_{2}\end{array}$$
And then arrange them in a standard state-space equation form:
$$ \left(\begin{array}{l}\dot{x}_{1} \\\dot{x}_{2} \\\dot{x}_{3} \\\dot{x}_{4}\end{array}\right)=\left(\begin{array}{cccc}0 & 0 & -\frac{1}{C_{1}} & -\frac{1}{C_{1}} \\0 & -\frac{1}{C_{2}\left(R_{1}+R_{2}\right)} & \frac{R_{1}}{C_{2}\left(R_{1}+R_{2}\right)} & -\frac{R_{2}}{C_{2}\left(R_{1}+R_{2}\right)} \\\frac{1}{L_{1}} & -\frac{R_{1}}{L_{1}\left(R_{1}+R_{2}\right)} & -\frac{R_{1} R_{2}}{L_{1}\left(R_{1}+R_{2}\right)} & -\frac{R_{1} R_{2}}{L_{1}\left(R_{1}+R_{2}\right)} \\\frac{1}{L_{2}} & -\frac{R_{2}}{L_{2}\left(R_{1}+R_{2}\right)} & -\frac{R_{1} R_{2}}{L_{2}\left(R_{1}+R_{2}\right)} & -\frac{R_{1} R_{2}}{L_{2}\left(R_{1}+R_{2}\right)}\end{array}\right)\left(\begin{array}{l}x_{1} \\x_{2} \\x_{3} \\x_{4}\end{array}\right)+\left(\begin{array}{c}0 \\\frac{R_{1}}{C_{2}\left(R_{1}+R_{2}\right)} \\-\frac{R_{1} R_{2}}{L_{1}\left(R_{1}+R_{2}\right)} \\-\frac{R_{1} R_{2}}{L_{2}\left(R_{1}+R_{2}\right)}\end{array}\right) i $$
I've searched a lot, but I can't find any reference to help me.
i3
andi4
you could use, well, Eliminate. $\endgroup$