Name : Balasubramaniyan K
Department : Artifical Intelligence and Data Science
Year : Second Year
Labsheet 1
Course Code : 23AID201
Course Name: Modeling Simulation and Analysis
Exp. No. : 1 MODELING AND SIMULATION OF A MASS-SPRING-DAMPER
SYSTEM USING MATLAB
AIM:
To model and simulate the behavior of a mass–spring–damper system using
MATLAB Simulink.
SOFTWARE USED:
• MATLAB (Simulink)
THEORY:
A mass-spring-damper system is a second-order dynamic system described by the
differential equation:
Where,
• m = mass (Kg)
• c = damping coefficient (Ns/m)
• k = spring constant (N/m)
• x(t) = displacement (m)
• F(t) = external force applied (N)
This system can be solved using numerical methods (ODE solvers in MATLAB) or
using state-space representation.
Procedure: Modeling and Simulation of a Mass–Spring–Damper System Using
MATLAB Simulink
Step 1: Open MATLAB and Simulink
1. Launch MATLAB.
2. In the Command Window, type:
simulink
3. Press Enter to open the Simulink Library Browser.
Step 2: Create a New Simulink Model
1. In the Simulink Library Browser, select File → New → Model.
2. A blank model window will appear.
3. Save the model as Mass_Spring_Damper_System.
Step 3: Mathematical Model
The governing equation of the mass–spring–damper system is:
Rearranging for acceleration:
Step 4: Add the Input Force
1. Open Simulink → Sources.
2. Drag a Step block into the model.
3. This block represents the external force (F(t)).
Step 5: Add the Gain Block for Mass
1. Open Simulink → Math Operations.
2. Drag a Gain block into the model.
3. Rename it as 1/m.
4. Set the gain value:
For (m = 5) kg:
Gain = 1/5 = 0.2
Step 6: Add Integrator Blocks
1. Open Simulink → Continuous.
2. Drag two Integrator blocks into the model.
The integrators perform:
• First Integrator → Velocity ((\dot{x}))
• Second Integrator → Displacement ((x))
Step 7: Add a Sum Block
1. Open Simulink → Math Operations.
2. Drag a Sum block into the model.
3. Double-click the block.
4. Set the List of Signs to:
+--
This performs the operation:
Step 8: Add Gain Blocks for Damping and Spring
1. Drag two additional Gain blocks.
2. Set the gains as:
Damping Gain (c) = 0.35
Spring Gain (k) = 0.5
Step 9: Connect the Blocks
1. Connect the Step Block to the positive input of the Sum block.
2. Connect the output of the first integrator (velocity) to the damping gain block
(c), then to the negative input of the Sum block.
3. Connect the output of the second integrator (displacement) to the spring gain
block (k), then to the other negative input of the Sum block.
4. Connect the output of the Sum block to the gain block (1/m).
5. Connect the output of (1/m) to the first integrator.
6. Connect the first integrator output to the second integrator.
7. The first integrator output represents velocity.
8. The second integrator output represents displacement.
Step 10: Add a Scope Block
1. Open Simulink → Sinks.
2. Drag a Scope block into the model.
3. Connect the displacement output (second integrator output) to the Scope.
Step 11: Run the Simulation
1. Select Simulation → Model Configuration Parameters.
2. Set:
Stop Time = 30 seconds
3. Click Run.
Step 12: View the Results
1. Double-click the Scope block.
2. Right-click inside the Scope window.
3. Select Autoscale.
The displacement response of the system will be displayed.
Step 13: Study Different Damping Conditions
Underdamped System
• Damping coefficient is less than the critical damping value.
• The system oscillates before settling.
• Overshoot is present.
Example:
c = 0.35
Critically Damped System
• Fastest return to equilibrium without oscillation.
• No overshoot occurs.
Critical damping coefficient:
Set:
Overdamped System
• Damping coefficient is greater than the critical damping value.
• No oscillation occurs.
• The response is slower than the critically damped case.
Example:
c=6
Observation
The system response varies with the damping coefficient. An underdamped system
exhibits oscillations, a critically damped system returns to equilibrium in the shortest
time without overshoot, and an overdamped system responds slowly without
oscillations.
Result
The mass–spring–damper system was successfully modeled and simulated in
MATLAB Simulink. The displacement response was obtained, and the effects of
underdamped, critically damped, and overdamped conditions were observed and
analyzed.
Practice Problem
Given Data
• Mass, m = 2 kg
• Spring Constant, k = 150 N/m
• Damping Coefficient, c = 10 Ns/m
• Initial Displacement, x(0) = 0.2 m
• Initial Velocity = 0 m/s
• External Force = 20 sin(5t)
(i) Time Response
Displacement Response
The displacement response is obtained from the displacement output of the system.
Initial displacement:
• x(0) = 0.2 m
Velocity Response
The velocity response is obtained from the velocity output of the system.
Initial velocity:
• v(0) = 0 m/s
Acceleration Response
The acceleration response is obtained from the acceleration output of the system.
The displacement, velocity, and acceleration responses exhibit oscillatory behavior
due to the harmonic excitation and gradually settle into a steady-state motion.
(ii) Damping Nature of the System
The critical damping coefficient is found to be:
• Critical Damping Coefficient = 34.64 Ns/m
Given damping coefficient:
• c = 10 Ns/m
Since the actual damping coefficient is less than the critical damping coefficient, the
system is Underdamped.
Characteristics of an Underdamped System
• Oscillatory response
• Presence of overshoot
• Gradual decay of oscillations
• Faster settling compared to an overdamped system
(iii) Effect of Harmonic External Force
The applied force is:
• F(t) = 20 sin(5t)
The harmonic force continuously excites the system and produces forced vibrations.
Effects of Harmonic Excitation
• Continuous oscillations occur in displacement, velocity, and acceleration.
• The system undergoes forced vibration.
• Damping limits the vibration amplitude.
• Initial transient oscillations gradually decay.
• The system eventually reaches a steady-state oscillatory response.
Observation
The system exhibits oscillatory behavior because the damping is relatively low. Due
to the harmonic external force, the mass continues to vibrate even after the transient
response has decayed. The damping present in the system controls the amplitude of
vibration and prevents excessive oscillations.
Result
Thus, the mass–spring–damper system was analyzed for the given parameters. The
displacement, velocity, and acceleration responses were obtained. The system was
identified as underdamped, and the effect of the harmonic force was studied. The
system exhibits damped oscillations initially and then settles into a steady-state
forced vibration.