Question: When a system oscillates over a fixed aperture, it can be considered to contain a mass - spring - damper set - up . This

When a system oscillates over a fixed aperture, it can be considered to contain a mass-
spring-damper set-up. This common model is often utilized in engineering applications
and mathematical simulations. Such model can be visualized in the following figure (Fig
1).
Figure 1: Example Mass Spring Damper.
In this project, you will create a program that takes the mass (m), damping ratio (c), spring
constant (k), and driving force (F) to find the reactionary motion of the mass over time.
The governing equation is a 2nd order differential equation (Eq 1).
md2x
dt2+ cdx
dt + kx = F (t)(1)
1
Specific Parameters
You are tasked to simulate the following trials and present the results:
Trail No. mass (kg) k (N/m) c (Ns/m)
132002
245045
3512550
For this project, we are simulating the homogeneous response, where the forcing func-
tion F (t)=0. The initial position is always x0=1 m.
Required Function
Develop a function called:
function [xkp1,vkp1]= VibrationPosition(xk,vk,m,k,c,f,dt,type)
where you would approximate the position of a mass-spring-damper system from the
second order partial differential equation for an individual time-step. The input values for
the functions are:
xk,vk - Iteration (k)[Position, Velocity]
m,k,c - Model Parameters (mass, spring constant, damping constant)
f - Forcing Function
dt - Time-step
type - Type of differentiation (1- Forward Euler or 2- Runge Kutta)
[xkp1, vkp1]- Iteration (k+1)[Position, Velocity]
Incorporate your function into the following main topics:
1. Forward Euler numeric scheme
Utilizing Forward Euler numeric schemes, e.g. given dy
dt = f (t, y)
df
dt = f (tk+1, y) f (tk, y)
t (2)
and using the given listed parameters:
(a) Solve for the homogeneous response of the mass-spring-damper ODEs and
plot the position of the mass vs. time.
2
Hint: You should break down the second order differential equation into two first
order equations in order to apply the numeric schemes. I.e. let v(t)= dx(t)
dt , then
d2x(t)
dt2= f (t) becomes:
dv(t)
dt = f (t)
dx(t)
dt = v(t)
(3)
2.4th Order Runge-Kutta
Utilizing 4th Order Runge-Kutta numeric schemes, e.g. given dx
dt = f (t, x)
c1=tf (tk, xk)
c2=tf
(
tk +1
2t, xk +1
2c1
)
c3=tf
(
tk +1
2t, xk +1
2c2
)
c4=tf (tk +t, xk + c3)
xk+1= xk +1
6c1+1
3c2+1
3c3+1
6c4
(4)
and using the given listed parameters:
(a) Solve for the homogeneous response of the mass-spring-damper ODEs and
plot the position of the mass vs. time.
3. Animation of Time Evolution
Generate a video of the mass position as it evolves over time for a mass-spring-
damper system for each trial. Use the following timestep for your output frame.
Initial Time (t0)0
Total Time (tf)10 seconds
Timestep (dt)1/300 seconds
Frames per Second (fps)30 frames per second
Note: Make sure ALL your plots contain the necessary title(s), legend(s), and axis-
label(s). You need to submit three 10 second videos along with your script on
Canvas. Use the naming convention LastName ID video # where # is 1,2, or 3.
3
4. Extra Credit (+20%): Inhomogeneous Response
For each of the three trials, also solve the inhomogeneous response, using
the forcing function F (t)= a0 sin (t/2\pi ), where a0=25 N.
Solve for the inhomogeneous response of the mass-spring-damper ODEs and
plot the position of the mass vs. time for each trial.
Then change the three video animation to plot both responses. Each video
should contain two plots side-by-side, with the left subplot being the homoge-
neous free response, and the right subplot being the inhomogeneous forced
response. Use the same timestep as step 3.
Hint: set f in the function input to an array: [f (t0),f (t0+1
2 dt),f (t0+ dt)]
Note: If you completed the extra credit, you may replace the video submission in
part 3 with the three videos in part 4 instead.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!