Question: Follow the steps below to complete your program. Create Script File. Open MATLAB and navigate to the directory location where you wish to save your

Follow the steps below to complete your program.
Create Script File. Open MATLAB and navigate to the directory location where you wish to save
your work. Begin a new script file by typing CTRL-N or by clicking the 'New Script' button. Save
your script file as 'Week 8 Program',
Create Variables. Using the input command, prompt the user for m,c,k,x0, and v0.
Solve the Equation of Motion. In a separate function file, solve the equation of motion using one
of the four solution forms described above. This should be done with a decision structure of your
choice (i.e.'if', 'switch', etc.) Inputs to your function should include the five variables collected in the
previous step. Outputs from the function should include a vector containing mass position, a vector
containing time, and a string variable containing the type of system (overdamped, underdamped,
etc.) Note that the time required to capture the entire response will vary; consider making the
length of your time vector dependent on the inputs. After the function runs, display a message in the
command window using fprintf that states the type of system, e.g. "System is underdamped."
Plot Results. Using another input command, create a prompt to ask the user if a plot of the
results is desired. If yes, the program should call a second function that plots time versus mass
position. Please remember to label your axes. Note that the call to this function will not return any
outputs.
Write Results. Using another input command, create a prompt to ask the user if writing the
results to a spreadsheet is desired. If yes, the program should call a third function that does the
following:
Creates a filename containing the type of system, e.g. "ResultsUnderdamped.xls".
Checks to see if the file already exists; if yes, asks the user if the existing file should be over-
written; if the user selects 'no" then they should be prompted for a new filename.
In cells A1- A5, write labels for the five initial variables.
In cells B1- B5, write the values for the five initial variables.
In cells A6 and B6, place the labels "Time" and "Position", respectively.
Write your time and position data points to the spreadsheet file starting in cells A7 and B7,
respectively.
Re-Run Program. Using a while loop placed around all the code in your main script, provide
the ability for the user to re-run the program.
File Upload and Interpretation. Upload your script file, your function files, and a representative
results spreadsheet in Canvas using the link provided. In the Canvas comments box, provide a brief
description of your findings.
Follow the steps below to complete your program.

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 Programming Questions!