Clear Filters
Clear Filters

Dynamics of a Spring Mass Damper

13 views (last 30 days)
Igor Braz Gonzaga
Igor Braz Gonzaga on 18 Mar 2022
Answered: Shivam Gothi on 22 Aug 2024 at 10:48
Hi. I am new in Matlab and I am trying to modeling a spring-mass-damper system representing a structural model with an external force F (t ) acting.
The differential equation of the model is : .
where m, c and k are respectively, the modal mass, damping coeficient and stiffness.
I solve this Equation with ODE45 for a sinusoidal external force and it works well, but when I try change F(t) to be a stochastic load (wind loads, earthquakes loads or human walking loads, for example), it does not run.
Does anyone knows which is the problem? or how can I fix it?
  1 Comment
Les Beckham
Les Beckham on 18 Mar 2022
You really need to provide the Matlab code that you say "does not run" and tell us what specific error message or other unexpected results that you are seeing. We can not guess how to fix "it" when you haven't shown us what "it" is.
You can edit your question and attach the code with the paperclip icon. Be sure to provide all of the inputs that your are using to run your code.

Sign in to comment.

Answers (1)

Shivam Gothi
Shivam Gothi on 22 Aug 2024 at 10:48
Hello,
I understand that you need to simulate a mass-spring damper system when subjected to the stochastic loads such as human walking loads, earthquake loads etc. This is possible using MATLAB ode45 function and stochastic load data.
I have attached the implementation in ‘SpringMass.m’. Please find a more comprehensive description of the code below:
  • In this scenario, "human walking loads" are considered as random loads.
  • The Excel file "Stochastic_load.xls" contains load magnitudes represented as time series data, where Column 1 lists time values and Column 2 provides the corresponding force magnitudes at each time point.
  • A MATLAB script processes reads the file, storing the stochastic load values and time steps in the variables "Force" and "time," respectively.
  • A custom function, "Mass_spring_damper()," is developed to model the system's differential equation.
  • The user-defined function "F()" returns the force magnitude at a given time "t."
  • The model's differential equations are solved using MATLAB's "ode45" function. For further details, please consult the following documentation:
  • As a final step, the position and velocity of mass and stochastic disturbance are plotted as a function of time.
  • Below give are the responses obtained by simulating the system for 10 seconds
  • (Note : Here I have assumed the following values : (“m” = 0.1 kg ; “k” = 0.1 ; “c” = 0.05). You can change them in the script according to your need. (Inside the function Mass_spring_damper( ) )
I hope this solves the issue !

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!