An ideal one-dimensional oscillating system consists of two unit masses, $${m}_{1}$$ and $${m}_{2}$$, confined between two walls. Each mass is attached to the nearest wall by a spring of unit elastic constant. Another such spring connects the two masses. Sensors sample $${a}_{1}$$ and $${a}_{2}$$, the accelerations of the masses, at $${F}_{s}=16$$ Hz.

Specify a total measurement time of 16 s. Define the sampling interval $$\Delta t=1/{F}_{s}$$.

The system can be described by the state-space model

$$\begin{array}{c}x(n+1)=Ax(n)+Bu(n),\\ y(n)=Cx(n)+Du(n),\end{array}$$

where $$x={\left(\begin{array}{cccc}{r}_{1}& {v}_{1}& {r}_{2}& {v}_{2}\end{array}\right)}^{T}$$ is the state vector and $${r}_{i}$$ and $${v}_{i}$$ are respectively the location and the velocity of the $$i$$th mass. The input vector $$u={\left(\begin{array}{cc}{u}_{1}& {u}_{2}\end{array}\right)}^{T}$$ and the output vector $$y={\left(\begin{array}{cc}{a}_{1}& {a}_{2}\end{array}\right)}^{T}$$. The state-space matrices are

$$A=\mathrm{exp}({A}_{c}\Delta t),\phantom{\rule{1em}{0ex}}B={A}_{c}^{-1}(A-I){B}_{c},\phantom{\rule{1em}{0ex}}C=\left(\begin{array}{cccc}-2& 0& 1& 0\\ 1& 0& -2& 0\end{array}\right),\phantom{\rule{1em}{0ex}}D=I,$$

the continuous-time state-space matrices are

$${A}_{c}=\left(\begin{array}{cccc}0& 1& 0& 0\\ -2& 0& 1& 0\\ 0& 0& 0& 1\\ 1& 0& -2& 0\end{array}\right),\phantom{\rule{1em}{0ex}}{B}_{c}=\left(\begin{array}{cc}0& 0\\ 1& 0\\ 0& 0\\ 0& 1\end{array}\right),$$

and $$I$$ denotes an identity matrix of the appropriate size.

The first mass, $${m}_{1}$$, receives a unit impulse in the positive direction.

Use the model to compute the time evolution of the system starting from an all-zero initial state.

Plot the accelerations of the two masses as functions of time.

Convert the system to its transfer function representation. Find the response of the system to a positive unit impulse excitation on the first mass.

Plot the result. The transfer function gives the same response as the state-space model.

The system is reset to its initial configuration. Now the other mass, $${m}_{2}$$, receives a unit impulse in the positive direction. Compute the time evolution of the system.

Plot the accelerations. The responses of the individual masses are switched.

Find the response of the system to a positive unit impulse excitation on the second mass.

Plot the result. The transfer function gives the same response as the state-space model.