AME 209/MSE 280
Studio 7 Fall 2024
Complete this problem, and turn in your work through D2L, preferably by the end of class,
but no later than 7:00 PM the day of lecture. Prepare your solutions in electronic form.
Two files are needed in order to complete the Studio 7 assignment. Name all of your files
in this format:
studio_07_xx.pdf
studio_07_xx.m
Your task is to modify your Matlab script from Homework 5. As before, your program will
plot a set of data. Your script will do the following (many items are unchanged from
Homework 5):
1. Asks 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 terminates).
2. 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.
3. Use a menu along with switch/case statements to allow the user to select the plot
symbol (choose one of star, square, circle, diamond).
4. After the plot symbol is chosen, a user input determines the color of the symbol
(using if/elseif/else statements). The script checks for user input error.
5. Ask the user to enter a plot title and labels for the x- and y-axes.
6. Using the Matlab subplot command, create a figure containing three plots of the
data on the screen. The first is a linear plot, the second a semilog plot, and the third
a log-log plot. Once the data is plotted, the program pauses so the user can view
the plots. The program resumes when the user hits any key.
For the semilog and log-log plots, you need to filter the data to deal with zero and
negative value points where the logarithm is undefined. Both the plots and the
exponential/power-law curve fitting routines will use only the filtered data.
7. The user can re-run the above with a new set of data.
Test your program by using three sets of data:
hw07_data01.dat
hw07_data02.dat
hw07_data03.dat
Plot each of these with representative fits.
For each data set, what type of equation do you think best describes the data?
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。