1.0 Instructions
Write MATLAB code to complete the following assignment. Make sure the code includes all required elements for proper code (e.g., header, problem statement, variable list, housekeeping commands, comments, assumptions).
2.0 Assignment
You have been given cooling data for many different spheres in an Excel workbook named “Cooling Data.xlsx”. The two worksheets are “Information” which contains the material name of the sphere and a formatting code, and “Data” which contains pairs of rows where the first row is the cooling time in minutes [min] and the second row is the difference in temperature between the object and the room in degrees Celsius [°C]. The order of the paired rows of data match the order of the material names in the other worksheet.
You should write a program that will read in the data from the workbook and give the user two options (1) create a summary plot that contains all the experimental data or (2) create a detail plot of an individual data set with the experimental data, theoretical trendline, and trendline equation. At the end of the program, the user should be asked if they want to create a new summary plot, detail plot, or end the program. Details for each of these steps is given below.
2.1 Importing Data. Read both worksheets from the Excel workbook into MATLAB storing the “Information” worksheet as a table, and the numeric data in the “Data” worksheet as a matrix.
2.2 First Choice. The user should be presented with the following dialog box. If the user does not select one of the two options, a warning should appear to tell the user they did not make a valid selection and the dialog box should reappear. This should happen as many times as necessary until a selection is made by the user.
Hint: take a look at the is empty function.
2.3 Summary Plot. If the user selects the summary plot, the program should plot all the data set pairs on a new figure. Plot only the experimental data, do not add trendlines. Each data set should be formatted using the specified format codes listed in the workbook, and a legend should be included to identify all the data sets by their material name. This should work no matter how many data sets are in the workbook so do not hardcode! The figure should include all proper plot elements, including a title. The x axis should be displayed from 0 to 10 minutes and the y axis should be displayed from 0 – 100°C.
2.4 Detail Plot. If the user selects the detail plot, the program should allow the user to select a material corresponding to a data set from a list. If the user does not make a selection, display an error message and terminate the program.
Then for material selected by the user, create a new figure and plot the experimental data set using the specified formatting in the workbook, the trendline for that data set, and trendline equation. The color of the trendline and the border color of the equation should match the experimental marker color (Note: color will always be the first letter in the format pair). The figure should include all proper plot elements, including a title which should be the name of the material selected. The x axis should be displayed from 0 to 10 minutes and the y axis should be displayed from 0 – 100°C.
2.5 Choice to Repeat. After the selected plot has been created, the user should be presented with the following dialog box (note that it is different than the original dialog box). If the user does not select one of the three options, a warning should appear to tell the user they did not make a valid selection and the dialog box should reappear. This should happen as many times as necessary until the user makes a selection. If they select Summary or Detail the program should repeat and if they select Stop the program should end