You are on page 1of 6

Spring-Mass-Damper System

The spring-mass-damper system is a second-order differential equation that models the dynamics of
a mass attached to a spring and a damper. The system is characterized by three parameters: the mass
of the object (m), the spring constant (k), and the damping coefficient (c).

Mathematical Equations:

The dynamics of the spring-mass-damper system can be described by the following second-order
differential equation:

mx''(t) + cx'(t) + k*x(t) = F(t)

Where x(t) is the displacement of the mass from its equilibrium position at time t, x'(t) is the velocity
of the mass at time t, x''(t) is the acceleration of the mass at time t, F(t) is the external force acting on
the mass at time t, and m, c, and k are the mass, damping coefficient, and spring constant,
respectively.

Input-Output Representation:

The input-output representation of the spring-mass-damper system is given by the transfer function:

G(s) = X(s)/F(s) = 1/(ms^2 + cs + k)

Where X(s) and F(s) are the Laplace transforms of the displacement x(t) and the external force F(t),
respectively, and s is the Laplace variable.

State Space Representation:

The state space representation of the spring-mass-damper system can be derived by introducing the
state variables x1 = x(t) and x2 = x'(t). The system can then be written in the following form:

x1'(t) = x2(t)

x2'(t) = -(c/m)*x2(t) - (k/m)*x1(t) + (1/m)*F(t)

Which can be represented in matrix form as:

x'(t) = Ax(t) + BF(t)

y(t) = Cx(t) + DF(t)

Where x(t) = [x1(t), x2(t)]^T is the state vector, y(t) is the output, A = [0, 1; -k/m, -c/m], B = [0; 1/m], C
= [1, 0], and D = 0.

Stability Analysis:

The stability of the spring-mass-damper system can be analyzed using the eigenvalues of the system
matrix A. If all eigenvalues have negative real parts, then the system is stable. Otherwise, the system
is unstable.
Free Evolution:

The free evolution of the spring-mass-damper system is the response of the system to initial
conditions, in the absence of any external input. The solution to the state equation with zero input is
given by:

x(t) = e^(At)*x0

Where x0 is the initial state vector. The free evolution of the system is a damped oscillation, whose
amplitude and frequency depend on the initial conditions and the system parameters.

Force Response:

The force response of the spring-mass-damper system is the response of the system to external
inputs, such as step, sinusoidal, or ramp signals. The response can be computed by solving the state
equation with the appropriate input. The steady-state response of the system to a sinusoidal input of
frequency w is given by:

x(t) = H(w)sin(wt - phi)

Where H(w) is the frequency response function of the system, and phi is the phase angle. The
frequency response function can be obtained by evaluating the transfer function G(s) at s = j*w.

Frequency Response:

The frequency response of the spring-mass-damper system is a measure of how the system responds
to different input frequencies. The frequency response

……………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………………….

Input/output representation:

Inputs:

m: mass

k: spring constant

c1: damping coefficient (system 1)

c2: damping coefficient (system 2)

x0: initial condition

Outputs:

sys_c1: state-space representation of system 1


sys_c2: state-space representation of system 2

y_free1: output of system 1 during free evolution

y_free2: output of system 2 during free evolution

u_sq: square wave input

time_sq: time vector for square wave input

y_sq: output of system 1 in response to the square wave input

State space representation:

For both systems:

State vector: x = [x1; x2] (where x1 and x2 are the states of the system)

Input vector: u = [u1]

Output vector: y = [y1]

System 1:

State matrix: a1 = [0 1; -k/m -c1/m]

Input matrix: b = [0; 1/m]

Output matrix: c = [1 0]

Direct transmission matrix: d = 0

System 2:

State matrix: a2 = [0 1; -k/m -c2/m]

Input matrix: b = [0; 1/m]

Output matrix: c = [1 0]

Direct transmission matrix: d = 0

Transfer function:

The transfer function representation is not explicitly provided in the code.

Stability analysis:
The stability of the systems can be determined by analyzing the eigenvalues of the state matrices (a1
and a2). If all eigenvalues have negative real parts, the systems are stable.

Free evolution:

The code simulates the free evolution of the systems and plots the output over time. The initial
condition (x0) is used as the starting point for the simulation.

Force response:

The code computes and plots the step response of the systems. It also shows the step response with
an amplitude of 0.5. The step response represents the system's response to a sudden change in the
input.

Frequency response:

The code generates a square wave input and computes the system's response to it using the lsim
function. It then plots the input and output over time, showing the system's response to the square
wave input

……………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………………….

Sure! Here's an example of a Simulink model for a spring-mass-damper system with a controller:

Open Simulink and create a new model.

Drag and drop the following blocks from the Simulink Library Browser onto the model canvas:

Integrator (from the Continuous library)

Sum (from the Math Operations library)

Gain (from the Math Operations library)

Connect the blocks as follows:


Connect the output of the Integrator block to one input of the Sum block.

Connect the output of the Gain block to the other input of the Sum block.

Connect the output of the Sum block to the input of the Integrator block.

Double-click on the Gain block to set its value as the desired controller gain.

Double-click on the Integrator block to set its initial condition.

Add the Spring-Mass-Damper system to the model:

Drag and drop a Transfer Fcn block (from the Continuous library) onto the model canvas.

Double-click on the Transfer Fcn block to set its numerator and denominator coefficients based on
the system parameters.

Connect the output of the Transfer Fcn block to the input of the Sum block.

To visualize the response, add a Scope block (from the Sinks library) and connect it to the output of
the Transfer Fcn block.

Configure the simulation parameters by clicking on the Configuration Parameters button (the gear
icon).

Set the simulation time and other desired parameters.

Click the Run button to simulate the system and observe the response on the Scope.

Here's an example of the Simulink model:

Simulink Model

In this model, the Transfer Fcn block represents the spring-mass-damper system, the Gain block
represents the controller, and the Integrator block represents the integral action. The Sum block
sums the control signal and the integral action to generate the input for the spring-mass-damper
system. The Scope block is used to visualize the system response.
You can adjust the parameters and settings based on your specific requirements for the spring-mass-
damper system and the controller.

You might also like