Dynamics of a Spring Mass Damper
13 次查看(过去 30 天)
显示 更早的评论
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 :
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/931119/image.png)
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 个评论
Les Beckham
2022-3-18
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.
回答(1 个)
Shivam Gothi
2024-8-22,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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1757759/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1757764/image.png)
- (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 !
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!