3

Blog | Modelling Of Free Oscillations Of Mass-Spring System

 2 years ago
source link: https://matlabhelper.com/blog/matlab/modelling-of-free-oscillations-of-mass-spring-system/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Modelling of Free Oscillations of a Mass-Spring System

Introduction

Linear ordinary differential equations have critical applications in mechanical systems and electrical systems. In this blog, we will try to model and solve a simple mechanical system that will consist of a mass suspended on an elastic spring, also known as a "mass-spring system". The blog is in two parts. In the first part, we will start by setting up our mass-spring system with ideal conditions, i.e., having undamped motion. While in the second part, we will make our model realistic by introducing damping to our system. We will also discuss the three cases of damping.

Setting up the Mass-Spring Model

Start by considering a mass suspended on an ordinary coil spring that resists compression and extension. The spring is suspended from a fixed support.

Mass-spring image

Mass spring system

Assuming that we pull down the mass by an amount y>0, then, according to Hooke's law, there will be a spring force F_{1}=-ky.

Here k(>0) is the spring constant. The negative sign indicates that the direction of force F_{1} is upward. There is also an additional force (-F_{o})in the spring. However, F_{o} does not affect the motion because it is in equilibrium with the weight of the ball, i.e., -F_{o}=W=mg

The motion of this mass-spring system can be determined by Newton's second law of motion, mass\times acceleration = my''=Force.

Forming the ODE of Undamped System

For now, we will consider that the damping of our system is minimal and, therefore, can be neglected. If we consider the motion of the system over a short time, then Newton's law gives the model my''=-F_{1}=-ky; thus

                                                                          my''+ky=0

The above equation is a homogeneous linear ODE and can be solved to obtain the general solution

y(t)=Acos\omega _{o}t+Bsin\omega _{o}t;    \omega_{o}= \sqrt{\frac{k}{m}}

This motion of the mass-spring system is called a harmonic oscillation and has the frequency f=\frac{\omega _{o}}{2\pi }Hertz^{3}.

Implementing the Model of Mass-Spring System in MATLAB

Let's implement this model of simple harmonic motion in MATLAB and check the results. We will start with the following initialization condition:

% Initialization
W = 98;                              % weight of ball = 98nt
k = W/1.09;                        % spring constant
g = 9.8;                               % acceleration due to gravity
m = W/g;                            % mass of ball
w0 = sqrt(k/m);

Get Access to
MATLAB Codes!

We all came across the infamous mass-spring system during our physics classes. This time we will revisit it with the visualization power of MATLAB; Developed in MATLAB R2018a with Symbolic toolbox.

Now we will define the symbolic function for y(t) and will try to solve the ODE my''+ky=0 for the initial conditionsy(0)=A=0.16 and y'(0)=\omega _{o}B=0. We will use the dsolve() function to solve the equation and get a particular solution.

Finally, we will plot the equations to get our graph of simple harmonic oscillations of our mass-spring system. Keep in mind that the t has a short-range (usually in seconds). Also, convert the values of the solution of ODE into a double type variable otherwise, MATLAB will give you an error.

On running the code, you should get a graph like the following.

undamped_oscillations_graph

Undamped oscillations of Mass-spring system

Healthcare Quiz Contest - Q1'22

Book - Machine Learning Training Module

Join Course - Deep Learning

Be our Brand Representative

Introducing damping to the system

Now, lets introduce the damping force F_{2}=-cy' to our system my''=-ky where c is the damping constant. The ODE of this damped mass-spring system is my''+cy'+ky=0. This damping force can be physically introduced by connecting the ball to a dashpot. Let \lambda=y'', then the ODE can be represented as \lambda^{2}+\frac{c}{m}\lambda +\frac{k}{m}=0. This equation is a quadratic equation and upon solving it, we get the roots as \lambda_{1}=-\alpha +\beta ,\lambda_{2}=-\alpha -\beta. Here \alpha= \frac{c}{2m} and \beta=\frac{1}{2m} \sqrt{c^{2}-4mk}. Depending upon the value of c, there will be three cases of damping.

Case 1: Over damping

If the damping constant c is very large (c^{2}>4mk), then \lambda_{1} and \lambda_{2} become two distinct real roots and the general solution thus obtained for the ODE is,

y(t)=c_{1}e^{-(\alpha -\beta )t}+c_{2}e^{-(\alpha +\beta)t}

Here, for t>0, both the exponents have a negative value and hence both terms approach zero. Practically, the mass will be at rest at the static equilibrium position after a long time.

Case 2: Critical damping

This case occurs when the roots of the equation are equal or we can say that c^{2}=4mk. The general solution of the ODE is

y(t)=(c_{1}+c_{2}t)e^{-\alpha t}

Critical damping is usually the case between nonoscillatory motions and oscillations.

Case 3: Under damping

This case occurs when the damping constant c is very small that is, c^{2}<4mk. Here, \beta is imaginary,

\beta =i\omega ^{*}

Here, \omega ^{*}=\frac{1}{2m}\sqrt{4mk-c^{2}}

The roots of the quadratic equation are complex conjugates and the corresponding general equation of the ODE is,

y(t)=e^{-\alpha t}(Acos\omega ^{*}t+Bsin\omega ^{*}t)=Ce^{-\alpha t}cos(\omega ^{*}t-\delta )

This case represents the actual damped oscillations.

Implementing the damped model of mass-spring system

We will start by introducing the damping constants to the initialization condition.

We will also introduce the new differential equations due to the three damping constants. Also, change the required lines that are used for solving the differential equations. Again, we are using the dsolve() function to solve the ODEs.

Now, just plot the graphs of these equations. This time we will also turn on legends so that we can differentiate between the different graphs and check which one belongs to over damping, critical damping and under damping.

Now, lets run the code and check our results.

damped oscillations result

Damped oscillations of a Mass-spring System

Unlink the undamped mass-spring system, here, the system comes to rest after some time has passed.

Summary

We have created an ideal mass-spring system with an ODE for our undamped system. We also implemented our system in MATLAB and got the desired results. We also introduced damping to this system. We discussed the three damping cases, i.e., overdamping, critical damping, and under damping, and checked its effects on the system using MATLAB.

Conclusion

Mass-spring systems are the fundamental bodies used in modelling and solving certain engineering problems related to designing certain structures. Some of these problems are understanding the working of pendulums, designing the suspension systems of vehicles, analyzing the building response to an earthquake. The damped mass-spring systems are also employed to study certain designs' rigid body dynamics.

Did you find some helpful content from our video or article and now looking for its code, model, or application? You can purchase the specific Title, if available, and instantly get the download link.

Thank you for reading this blog. Do share this blog if you found it helpful. If you have any queries, post them in the comments or contact us by emailing your questions to [email protected]. Follow us on LinkedIn Facebook, and Subscribe to our YouTube Channel. If you find any bug or error on this or any other page on our website, please inform us & we will correct it.

If you are looking for free help, you can post your comment below & wait for any community member to respond, which is not guaranteed. You can book Expert Help, a paid service, and get assistance in your requirement. If your timeline allows, we recommend you book the Research Assistance plan. If you want to get trained in MATLAB or Simulink, you may join one of our training modules. 

If you are ready for the paid service, share your requirement with necessary attachments & inform us about any Service preference along with the timeline. Once evaluated, we will revert to you with more details and the next suggested step.

Education is our future. MATLAB is our feature. Happy MATLABing!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK