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 CTRLN or by clicking the 'New Script' button. Save
your script file as 'Week Program',
Create Variables. Using the input command, prompt the user for and
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 ieif '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, eg "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, eg "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 A A write labels for the five initial variables.
In cells B B write the values for the five initial variables.
In cells A and B place the labels "Time" and "Position", respectively.
Write your time and position data points to the spreadsheet file starting in cells A and B
respectively.
ReRun Program. Using a while loop placed around all the code in your main script, provide
the ability for the user to rerun 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.
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
