Question 5.19: A Two-Degree-of-Freedom Mass–Spring System Consider the two-...
A Two-Degree-of-Freedom Mass-Spring System
Consider the two-degree-of-freedom mass-spring system shown in Figure 5.106. The mathematical model of the system is given by a set of ordinary differential equations
\begin{gathered} m_{1} \ddot{x}_{1}+\left(k_{1}+k_{2}\right) x_{1}-k_{2} x_{2}=0, \\ m_{2} \ddot{x}_{2}-k_{2} x_{1}+k_{2} x_{2}=0 \end{gathered}
where m_{1}=m_{2}=5 \mathrm{~kg}, k_{1}=2000 \mathrm{~N} / \mathrm{m}, and k_{2}=4000 \mathrm{~N} / \mathrm{m}. Assume that initially \mathbf{x}(0)=\left[\begin{array}{ll}0 & 0\end{array}\right]^{T} and \dot{\mathbf{x}}(0)=\left[\begin{array}{ll}1 & 0\end{array}\right]^{T}.
a. Build a Simulink model of the system based on the mathematical representation and find the displacement outputs x_{1}(t) and x_{2}(t).
b. Convert the ordinary differential equations to the state-space form and repeat Part (a).
c. Build a Simscape model of the physical system and find the displacement outputs x_{1}(t) and x_{2}(t).

Learn more on how we answer questions.
a. Solving for the highest derivatives of the output x_{1} and x_{2}, respectively, gives
\begin{gathered} \ddot{x}_{1}=\frac{1}{m_{1}}\left[-\left(k_{1}+k_{2}\right) x_{1}+k_{2} x_{2}\right], \\ \ddot{x}_{2}=\frac{1}{m_{2}}\left(k_{2} x_{1}-k_{2} x_{2}\right) . \end{gathered}
The corresponding Simulink block diagram is shown in Figure 5.107, where four Integrator blocks are included to obtain the signals \dot{x}_{1}, x_{1}, \dot{x}_{2}, and x_{2}. The default initial condition of an integrator block is 0 . Double-click on the Integrator block corresponding to \dot{x}_{1} and define the Initial Condition as 1 , which is the only nonzero initial value.
b. Define the state and the output vectors as
\mathbf{x}=\left\{\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\}=\left\{\begin{array}{l} x_{1} \\ x_{2} \\ \dot{x}_{1} \\ \dot{x}_{2} \end{array}\right\}, \quad \mathbf{y}=\left\{\begin{array}{l} x_{1} \\ x_{2} \end{array}\right\}
The state-space representation is
\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 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ -\frac{k_{1}+k_{2}}{m_{1}} & \frac{k_{2}}{m_{1}} & 0 & 0 \\ \frac{k_{2}}{m_{2}} & -\frac{k_{2}}{m_{2}} & 0 & 0 \end{array}\right]\left\{\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\} ,
\mathbf{y}=\left[\begin{array}{llll} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{array}\right]\left\{\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array}\right\} .
The Simulink block diagram built based on the state-space form is shown in Figure 5.108, in which a state-Space block is used to represent the mass-spring system. Note that no external forces are acting on the mass blocks and thus a Constant block with a scalar value of 0 is included. Double-click on the State-Space block and define the matrices \mathbf{A}, \mathbf{B}, \mathbf{C}, and \mathbf{D}, where \mathbf{B} is a 4 \times 1 zero matrix and \mathbf{D} is a 2 \times 1 zero matrix. The parameter of Initial conditions is [0 ; 0 ; 1 ; 0], which corresponds to \left[x_{1}(0) ; x_{2}(0) ; \dot{x}_{1}(0) ; \dot{x}_{2}(0)\right]. The bar-shaped block in Figure 5.108 is called Demux, which can be found in the library of Signal Routing and is used to split the vector signal \mathbf{y} into two signals x_{1} and x_{2}.
c. The Simscape block diagram corresponding to the physical system is shown in Figure 5.109, which can be created by following the steps similar to those in Example 5.18. To define the nonzero initial velocity \dot{x}_{1}, double-click on the Mass block representing m_{1}, type 1 for the Initial velocity, and choose the unit as \mathrm{m} / \mathrm{s}.
Define the values of the parameters m_{1}, m_{2}, k_{1}, and k_{2} in the MATLAB Command window. Run all simulations and the same curves as shown in Figure 5.110 will be obtained, which are the resulting displacement outputs x_{1}(t) and x_{2}(t) due to the nonzero initial condition.



