AME 209/MSE 280Homework 4 Fall 2024The homework 4 solution will only include two m-files, one for each of the following problems.No PDF writeup is needed for this assignment. Name your solution files:hw04_prob1_NNNN.mhw04_prob2_NNNN.msubstituting the last four digits of your student number for NNNN. Submit your homework
through D2L.The ages of six people, Alice, Barb, Carol, Dean, Eric and Fred, are as follows:Alice is twice the age of Carol.The total age of Barb and Eric equals that of Fred.The total age of Alice and Carol equals the total age of Barb and Fred.Carol is 8 years younger than Fred.f you subtract the sum of Eric’s and Carol’s ages from Dean’s, the result is 10.What is the age of each person?
- You are to write a program that sets up this system of linear equationsand solves for the unknowns. Using a text editor, store the combined datafor M and b in a file called DataRows.dat such that the coefficients for eachequation are stored in rows. (For example, the first row of the file shouldcontain these values: 1 1 1 1 1 1 92)
- Write a MATLAB script, hw04_prob1_NNNN.m that will allow the user tosolve a set of simultaneous equations. The program should begin bydisplaying a header that describes the purpose of the program. The scriptthen requests the user to enter the name of the data file, checks for badfilenames, checks for ad data (e.g., a set of equations that are not linearlyindependent), 代 写AME 209/MSE 280 solution and solves the system. Include a loop to allow the user theoption to rerun the script with a different set of data, again checking foruser input errors. The program must accept systems of any size (i.e., 2equations, 3 equations, etc.).
- Make sure the M-file script contains comment lines, indented text, whitespace, etc. so it is easy to read and understand. Run your script and solvethe problem.Useful commands for this problem include: size, abs, det, mldivide, exist,load.2. You are to write a Matlab script, hw04_prob2_NNNN.m that reads a data file ancounts the frequency of occurrence of a selected number. Download the data file
homework04_data.dat from the class web page into your folder.
- The program should begin by displaying a header that describes thepurpose of the program. Your program asks the user for the name of a datafile, then loads the file. The program displays an error message if the filedoes not exist. If this occurs, the file name can be re-entered, but the user isallowed only three tries. After three failed attempts at entering a validfilename, the program displays an appropriate message and ends.
- The program asks the user to enter a number to search. The programrounds the absolute value of the entered number down to an integer, andchecks that it is in the range of 1 to 99. If not, the user enters anothernumber.
- The program determines how many times the number appears in the dataset (the frequency). The result is displayed on the screen in the followingformat where X is the selected number, F is the frequency, and N is thenumber of data points in the file:The number X appears F times in the data set which contains N numbers.
- The program allows the user to redo the search as many times as desiredusing the same data set) by selecting another number. Use a user menuinterface to ask the user if they want to select another number.
- The program allows the user to re-run the analysis and enter a new data setand a new number. (The user input must be checked for errors.)
- Your script MUST be understandable. Include lots of comments to explainwhat your program is doing and use descriptive variable names.Useful Matlab functions include: exist, load, floor, abs, length, and break.Page 2