---
title: "State space model of two-mass system"
subject: "Control Systems"
chapter: 8
key: "semester_3/control_systems:ss-m1-m2-k1b1-k2b2-outputs"
source: https://www.bctengineer.com/q/semester_3/control_systems/ss-m1-m2-k1b1-k2b2-outputs
site: BCT Engineering
---

# State space model of two-mass system

Control Systems · Chapter 8: State Space Analysis

- Asked in: 2080 Baisakh, 8 marks
- Video: [State space representation of mechanical system with two masses](https://www.youtube.com/watch?v=oqoN9aaYYU8) — STEM Course Prep
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/control_systems/ss-m1-m2-k1b1-k2b2-outputs
- Whole chapter: https://www.bctengineer.com/md/semester_3/control_systems/chapter-8

## Question

Obtain a state-space representation of the mechanical system shown in the figure where external force F is the input and the displacements of the masses x1 and x2 are the outputs. [Figure: wall – spring k2 parallel with damper b2 – mass m2 (displacement x2, on rollers) – spring k1 parallel with damper b1 – mass m1 (displacement x1, on rollers, force F applied)]

## Short answer

Use states x1, ẋ1, x2, ẋ2. The state-space model is ẋ=Ax+BF, y=Cx with A = [[0,1,0,0],[-k1/m1,-b1/m1,k1/m1,b1/m1],[0,0,0,1],[k1/m2,b1/m2,-(k1+k2)/m2,-(b1+b2)/m2]], B = [0,1/m1,0,0]ᵀ, C = [[1,0,0,0],[0,0,1,0]], D=0.

## Answer

A state-space model is obtained by writing Newton's second law for each mass and choosing the displacements and velocities as state variables (one pair per mass, so 4 states).

#### System and assumptions
```text
 wall |--[k2 || b2]--[ m2 ]--[k1 || b1]--[ m1 ]--> F
                      x2 ->               x1 ->
```
- Masses run on rollers, so there is no friction with the ground.
- $x_1$, $x_2$ are measured from equilibrium, positive to the right.
- $k_1$, $b_1$ connect $m_1$ and $m_2$; $k_2$, $b_2$ connect $m_2$ to the wall.

#### Equations of motion
Free body of $m_1$ (force $F$, spring and damper $k_1$, $b_1$ resisting relative motion):
$$
m_1\ddot{x}_1 = F - k_1(x_1 - x_2) - b_1(\dot{x}_1 - \dot{x}_2)
$$
Free body of $m_2$ (pulled by $k_1$, $b_1$; held back by $k_2$, $b_2$):
$$
m_2\ddot{x}_2 = k_1(x_1 - x_2) + b_1(\dot{x}_1 - \dot{x}_2) - k_2x_2 - b_2\dot{x}_2
$$

#### Choice of state variables
$$
z_1 = x_1,\quad z_2 = \dot{x}_1,\quad z_3 = x_2,\quad z_4 = \dot{x}_2,\quad u = F
$$

#### State equations
$$
\begin{aligned}
\dot{z}_1 &= z_2 \\
\dot{z}_2 &= -\frac{k_1}{m_1}z_1 - \frac{b_1}{m_1}z_2 + \frac{k_1}{m_1}z_3 + \frac{b_1}{m_1}z_4 + \frac{1}{m_1}u \\
\dot{z}_3 &= z_4 \\
\dot{z}_4 &= \frac{k_1}{m_2}z_1 + \frac{b_1}{m_2}z_2 - \frac{k_1 + k_2}{m_2}z_3 - \frac{b_1 + b_2}{m_2}z_4
\end{aligned}
$$

#### Matrix form
$$
\begin{bmatrix}\dot{z}_1\\ \dot{z}_2\\ \dot{z}_3\\ \dot{z}_4\end{bmatrix} =
\begin{bmatrix}
0 & 1 & 0 & 0\\
-\frac{k_1}{m_1} & -\frac{b_1}{m_1} & \frac{k_1}{m_1} & \frac{b_1}{m_1}\\
0 & 0 & 0 & 1\\
\frac{k_1}{m_2} & \frac{b_1}{m_2} & -\frac{k_1+k_2}{m_2} & -\frac{b_1+b_2}{m_2}
\end{bmatrix}
\begin{bmatrix}z_1\\ z_2\\ z_3\\ z_4\end{bmatrix} +
\begin{bmatrix}0\\ \frac{1}{m_1}\\ 0\\ 0\end{bmatrix}F
$$

#### Output equation
The outputs are the two displacements $y_1 = x_1$ and $y_2 = x_2$:
$$
\begin{bmatrix}y_1\\ y_2\end{bmatrix} =
\begin{bmatrix}1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\end{bmatrix}
\begin{bmatrix}z_1\\ z_2\\ z_3\\ z_4\end{bmatrix} +
\begin{bmatrix}0\\ 0\end{bmatrix}F
$$

#### Summary
| Matrix | Size | Meaning |
|---|---|---|
| $A$ | $4\times 4$ | Masses, springs, dampers |
| $B$ | $4\times 1$ | Force acts on $m_1$ only |
| $C$ | $2\times 4$ | Picks $x_1$ and $x_2$ |
| $D$ | $2\times 1$ | Zero (no direct path) |

**Answer:** $\dot{z} = Az + BF$, $y = Cz$ with $A$, $B$, $C$ as above and $D = 0$. Physical check: in the static case ($\dot{z} = 0$), the equations give $k_2x_2 = F$ and $k_1(x_1 - x_2) = F$, i.e. the two springs carry the same force in series, as expected.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why does this mechanical system have 4 state variables?
   A. There are four elements: two springs and two dampers
   B. Each mass is second order, so a displacement and a velocity are needed per mass
   C. There are two outputs and two inputs
   D. Each spring and damper pair adds one state
   Answer: B. Each mass gives a second-order equation, so two states (displacement and velocity) per mass give 4 states. (Key point: Number of states)

2. Which is the correct equation of motion for m1?
   A. m1 x1'' = F + k1(x1 - x2) + b1(x1' - x2')
   B. m1 x1'' = F - k1(x1 - x2) - b1(x1' - x2')
   C. m1 x1'' = F - k1 x1 - b1 x1'
   D. m1 x1'' = -k1(x1 - x2) - b1(x1' - x2')
   Answer: B. The spring and damper k1, b1 resist the relative motion x1 - x2, so they subtract from the applied force F. (Key point: Equation for m1)

3. Which forces act on m2?
   A. Only k2 and b2 from the wall
   B. Force F plus k1, b1
   C. k1, b1 pull it by the relative motion with m1, while k2, b2 hold it back against the wall
   D. Only k1 and b1 act on it
   Answer: C. m2 is connected to m1 through k1, b1 and to the wall through k2, b2, giving the term -(k1+k2)x2 - (b1+b2)x2' plus k1x1 + b1x1'. (Key point: Equation for m2)

4. What is B for state z = [x1, x1', x2, x2']^T and input F?
   A. [0; 1/m1; 0; 0]
   B. [0; 1/m1; 0; 1/m2]
   C. [1/m1; 0; 0; 0]
   D. [0; 0; 0; 1/m2]
   Answer: A. F acts only on m1, so it enters only the x1'' equation, the second row, with gain 1/m1. (Key point: Input matrix B)

5. What are C and D for outputs y1 = x1, y2 = x2?
   A. C = [1 0 0 0; 0 1 0 0], D = 0
   B. C = [1 0 0 0; 0 0 1 0], D = 0
   C. C = [0 1 0 0; 0 0 0 1], D = 0
   D. C = [1 0 1 0], D = 1
   Answer: B. x1 is z1 and x2 is z3, so C picks the 1st and 3rd states; there is no direct path, so D = 0. (Key point: Output matrix C)

## Related in Control Systems

- [Two-mass system X1/F, X2/F with F-V analogy](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Afv-tf-m1-m2-k1b1-k2b2) — Control Systems, chapter 2, asked 3×
- [Two-mass spring system X1/F and F-V analogy](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Atf-fv-m1-m2-k1-k2) — Control Systems, chapter 2
- [State model of two-mass spring system, output x2](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Ass-m1-m2-k1-k2-x2) — Control Systems, chapter 8
- [Free body diagram and X1/F, X2/F of two-mass system](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Afbd-m1-m2-k1k2-b1b2) — Control Systems, chapter 2
- [Two-mass system X2/F by free body diagram, F-V analogy](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Afbd-fv-m1-m2-k1-b1) — Control Systems, chapter 2
- [State space model of vertical two-mass system](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Ass-mech-m1-m2-k-b) — Control Systems, chapter 8

## Related in other subjects

- [Two oscillating masses: motion, centre of mass, energy](https://www.bctengineer.com/question.md?key=semester_3%2Fapplied_mechanics_dynamics%3Atwo-masses-springs-equations-energy) — Applied Mechanics (Dynamics), chapter 3
- [Spring-mass-damper instrument parameters](https://www.bctengineer.com/question.md?key=semester_4%2Finstrumentation_and_measurement%3Aspring-mass-damper-instrument-numerical) — Instrumentation and Measurement, chapter 4
