Welcome to our community

Be a part of something great, join today!

[SOLVED] State equations

dwsmith

Well-known member
Feb 1, 2012
1,673
I am trying to find the state equations for a mass spring system.
I found the transfer function to be
\[
H(s) = \frac{X_1(s)}{F(s)} = \frac{m_2s^2 + b_2s + k}
{s\big[m_1m_2s^3 + (m_2b_1 + m_1b_2)s^2 +
(k(m_1 + m_2) + b_1b_2)s + k(b_1 + b_2)\big]}
\]
I found the transfer function from
\begin{align}
m_1\ddot{x}_1 &= F - b_1\dot{x}_1 - k(x_1 - x_2)\\
m_2\ddot{x}_2 &= - b_2\dot{x}_2 - k(x_2 - x_1)
\end{align}
So I am trying to find the state matrices \(\mathbf{A}\), \(\mathbf{B}\), \(\mathbf{C}\), and \(\mathbf{D}\) where
\begin{align}
\dot{\mathbf{x}} &= \mathbf{A}\mathbf{x} + \mathbf{B}F\\
\mathbf{y} &= \mathbf{C}\mathbf{x} + \mathbf{D}F
\end{align}
The transfer function is extremely complicated though. How can I obtain the state matrices?

I do know what the matrices are, but I can't find obtain them:
\begin{align}
\mathbf{A} &=
\begin{bmatrix}
0 & 1 & 0 & 0\\
-\frac{k}{m_1} & -\frac{b_1}{m_1} & \frac{k}{m_1} & 0\\
0 & 0 & 0 & 1\\
\frac{k}{m_2} & 0 & -\frac{k}{m_2} & -\frac{b_2}{m_2}
\end{bmatrix}\\
\mathbf{B} &=
\begin{bmatrix}
0\\
\frac{1}{m_1}\\
0\\
0
\end{bmatrix}\\
\mathbf{C} &=
\begin{bmatrix}
1 & 0 & 0 & 0\\
0 & 0 & 1 & 0
\end{bmatrix}\\
\mathbf{D} &= \mathbf{0}
\end{align}
 
Last edited:

dwsmith

Well-known member
Feb 1, 2012
1,673
We can write this as one differential equation:
\[
m_1m_2\ddddot{w} + (m_1b_2 + m_2b_1)\dddot{w} + (k(m_1 + m_2) + b_1b_2)\ddot{w} + k(b_1 + b_2)\dot{w} = m_2\ddot{u} + b_2\dot{u} + ku
\]
If the LHS had only a 3rd time derivative and the RHS had only a first time derivative, I could follow the (harder) labeled example here.
But I have tried to follow that idea by setting up the q derivatives as
\begin{alignat}{2}
q_1 &= w\\
q_2 &= \dot{w}\\
q_3 &= \ddot{w}\\
q_4 &= \dddot{w} - m_2\dot{u} - b_2u\\
\dot{q}_1 &= \dot{w} &&={} q_2\\
\dot{q}_2 &= \ddot{w} &&={} q_3\\
\dot{q}_3 &= \dddot{w} &&={} q_4\\
\dot{q}_4 &= \ddddot{w} -m_2\ddot{u} - b_2\dot{u}
\end{alignat}
However, this didn't seem to work. Should the q's be setup differently? Or am I not implementing this correctly?
From my implementation, I had
\begin{align}
\dot{q}_4 &= ku - (m_2^2b_1 + m_1m_2b_2)\dot{u} - (m_2b_1b_2 + m_1b_2^2)u - (m_2b_1 + m_1b_2)q_4 - q_3(k(m_1 + m_2) + b_1b_2) - k(b_1 + b_2)q_2
\end{align}
However, I am suspect of
\[
- (m_2^2b_1 + m_1m_2b_2)\dot{u} - (m_2b_1b_2 + m_1b_2^2)u - (m_2b_1 + m_1b_2)q_4
\]
since there is a \(\dot{u}\) present which came from
\[
\dddot{w}(m_2b_1 + m_1b_2) = (m_2\dot{u} + b_2u + q_4)(m_2b_1 + m_1b_2).
\]
In the harder example, it says "The method has failed because there is a derivative of the input on the right hand, and that is not allowed in a state space model." This cause the concern with \(\dot{u}\) in \(\dot{q}_4\). Thus, I am lead to believe I need a slightly different setup for this problem.