Question: Submit the MATLAB script . m file on Course Canvas. Remember to use good coding practices by keeping your code organized, choosing suitable variable names,
Submit the MATLAB script m file on Course Canvas. Remember to use good coding practices by keeping your code organized, choosing suitable variable names, and commenting
where applicable. Any of your MATLAB m files should contain a few comment lines at the
top to provide the name of the script, a brief description of the function of the script, and
your name and ID Any submission that does not follow the abovementioned format will
receive point deductions!
Final Project Prompt
When a system oscillates over a fixed aperture, it can be considered to contain a massspringdamper setup This common model is often utilized in engineering applications
and mathematical simulations. Such model can be visualized in the following figure Fig
Figure : 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 nd order differential equation Eq
m
d
x
dt
c
dx
dt kx Ft
Specific Parameters
You are tasked to simulate the following trials and present the results:
Trail No mass kg k Nm c Nsm
For this project, we are simulating the homogeneous response, where the forcing function Ft The initial position is always x m
Required Function
Develop a function called:
function xkpvkp VibrationPositionxkvkmkcfdttype
where you would approximate the position of a massspringdamper system from the
second order partial differential equation for an individual timestep. The input values for
the functions are:
xkvk Iteration kPosition Velocity
mkc Model Parameters mass spring constant, damping constant
f Forcing Function
dt Timestep
type Type of differentiation Forward Euler or Runge Kutta
xkp vkp Iteration kPosition Velocity
Incorporate your function into the following main topics:
Forward Euler numeric scheme
Utilizing Forward Euler numeric schemes, eg given dy
dt ft y
df
dt
ftk y ftk y
t
and using the given listed parameters:
a Solve for the homogeneous response of the massspringdamper ODEs and
plot the position of the mass vs time.
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 vt dxt
dt then
d
xt
dt ft becomes:
dvt
dt ft
dxt
dt vt
th Order RungeKutta
Utilizing th Order RungeKutta numeric schemes, eg given dx
dt ft x
ctf tk xk
ctf
tk
t xk
c
ctf
tk
t xk
c
ctf tk t xk c
xk xk
c
c
c
c
and using the given listed parameters:
a Solve for the homogeneous response of the massspringdamper ODEs and
plot the position of the mass vs time.
Animation of Time Evolution
Generate a video of the mass position as it evolves over time for a massspringdamper system for each trial. Use the following timestep for your output frame.
Initial Time t
Total Time tf seconds
Timestep dt seconds
Frames per Second fps frames per second
Note: Make sure ALL your plots contain the necessary titles legends and axislabels You need to submit three second videos along with your script on
Canvas. Use the naming convention LastName ID video # where # is or
Extra Credit : Inhomogeneous Response
For each of the three trials, also solve the inhomogeneous response, using
the forcing function Ft a sin tpi where a N
Solve for the inhomogeneous response of the massspringdamper 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 sidebyside, with the left subplot being the homogeneous free response, and the right subplot being the inhomogeneous forced
response. Use the same timestep as step
Hint: set f in the function input to an array: ftft
dtft dt
Note: If you completed the extra credit, you may replace the video submission in
part with the three videos in part instead.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
