AME 209代做、代写Matlab 程序设计
- 首页 >> Database Homework 5
Fall 2024
AME 209/MSE 280
Prepare your solutions in electronic form. Four files are needed in order to complete the homework 5 assignment. Name all of your files in this format:
hw05_NNNN.pdf hw05_NNNN.m launches_NNNN.fig degrees_NNNN.fig
1. Your task is to write a MATLAB script, hw05_NNNN.m that plots a set of data from a file. Your program will do the following:
a. Ask the user to enter the name of a data file; the input is checked for errors, and up to four tries are allowed (otherwise the program aborts).
b. Read the data file and determine if the x-y data is stored as rows (a matrix with two rows) or as columns (a matrix with two columns). If rows, the x data is in row 1, the y data in row 2; if columns, the x data is in column 1, the y data in column 2. If the data file is not in one of these formats an error message is displayed.
c. Use a menu along with switch/case statements for the user to select the plot symbol (choose one of star, square, circle, diamond).
d. After the plot symbol is chosen, another menu determines the color of the symbol.
e. Ask the user to enter a plot title and labels for the x- and y-axes.
f. Create a plot of the data on the screen.
g. The user can re-run the above with a new set of data.
Test your program by creating two sets of data:
i. The number of worldwide non-commercial space launches over the period 1997 to 2009. Name your data file launches_NNNN.dat, and store the information as columns.
ii. The number of doctoral degrees in sociology awarded in the United States over the period 1997 to 2009. Name your data file degrees_NNNN.dat, and store the information as rows.
The data files should be written so that the year is on the x-axis. The information for these files can be found in the file hw05_rawdata.xlsx on the course website. Save the plots and insert them in the PDF for this assignment.
Fall 2024
AME 209/MSE 280
Prepare your solutions in electronic form. Four files are needed in order to complete the homework 5 assignment. Name all of your files in this format:
hw05_NNNN.pdf hw05_NNNN.m launches_NNNN.fig degrees_NNNN.fig
1. Your task is to write a MATLAB script, hw05_NNNN.m that plots a set of data from a file. Your program will do the following:
a. Ask the user to enter the name of a data file; the input is checked for errors, and up to four tries are allowed (otherwise the program aborts).
b. Read the data file and determine if the x-y data is stored as rows (a matrix with two rows) or as columns (a matrix with two columns). If rows, the x data is in row 1, the y data in row 2; if columns, the x data is in column 1, the y data in column 2. If the data file is not in one of these formats an error message is displayed.
c. Use a menu along with switch/case statements for the user to select the plot symbol (choose one of star, square, circle, diamond).
d. After the plot symbol is chosen, another menu determines the color of the symbol.
e. Ask the user to enter a plot title and labels for the x- and y-axes.
f. Create a plot of the data on the screen.
g. The user can re-run the above with a new set of data.
Test your program by creating two sets of data:
i. The number of worldwide non-commercial space launches over the period 1997 to 2009. Name your data file launches_NNNN.dat, and store the information as columns.
ii. The number of doctoral degrees in sociology awarded in the United States over the period 1997 to 2009. Name your data file degrees_NNNN.dat, and store the information as rows.
The data files should be written so that the year is on the x-axis. The information for these files can be found in the file hw05_rawdata.xlsx on the course website. Save the plots and insert them in the PDF for this assignment.