首页 > > 详细

代写MSE 280、代做MATLAB语言程序

项目预算:   开发周期:  发布时间:   要求地区:
AME 209/MSE 280
Homework 4 Fall 2024

The 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.m
hw04_prob2_NNNN.m

substituting the last four digits of your student number for NNNN. Submit your homework
through D2L.

1. The ages of six people, Alice, Barb, Carol, Dean, Eric and Fred, are as follows:

The sum of their ages is 92.
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.
If 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?

a. You are to write a program that sets up this system of linear equations
and solves for the unknowns. Using a text editor, store the combined data
for M and b in a file called DataRows.dat such that the coefficients for each
equation are stored in rows. (For example, the first row of the file should
contain these values: 1 1 1 1 1 1 92)

b. Write a MATLAB script, hw04_prob1_NNNN.m that will allow the user to
solve a set of simultaneous equations. The program should begin by
displaying a header that describes the purpose of the program. The script
then requests the user to enter the name of the data file, checks for bad
filenames, checks for bad data (e.g., a set of equations that are not linearly
independent), and solves the system. Include a loop to allow the user the
option to rerun the script with a different set of data, again checking for
user input errors. The program must accept systems of any size (i.e., 2
equations, 3 equations, etc.).

c. Make sure the M-file script contains comment lines, indented text, white
space, etc. so it is easy to read and understand. Run your script and solve
the problem.

Useful commands for this problem include: size, abs, det, mldivide, exist,
load.



Page 2
2. You are to write a Matlab script, hw04_prob2_NNNN.m that reads a data file and
counts the frequency of occurrence of a selected number. Download the data file
homework04_data.dat from the class web page into your folder.

a. The program should begin by displaying a header that describes the
purpose of the program. Your program asks the user for the name of a data
file, then loads the file. The program displays an error message if the file
does not exist. If this occurs, the file name can be re-entered, but the user is
allowed only three tries. After three failed attempts at entering a valid
filename, the program displays an appropriate message and ends.

b. The program asks the user to enter a number to search. The program
rounds the absolute value of the entered number down to an integer, and
checks that it is in the range of 1 to 99. If not, the user enters another
number.

c. The program determines how many times the number appears in the data
set (the frequency). The result is displayed on the screen in the following
format where X is the selected number, F is the frequency, and N is the
number of data points in the file:

The number X appears F times in the data set which contains N numbers.

d. The program allows the user to redo the search as many times as desired
(using the same data set) by selecting another number. Use a user menu
interface to ask the user if they want to select another number.

e. The program allows the user to re-run the analysis and enter a new data set
and a new number. (The user input must be checked for errors.)

f. Your script MUST be understandable. Include lots of comments to explain
what your program is doing and use descriptive variable names.

Useful Matlab functions include: exist , load, floor, abs, length, and break.

软件开发、广告设计客服
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 9951568
© 2021 www.rj363.com
软件定制开发网!