首页 > > 详细

辅导 DMU UH 1331 Project 1-

DMU UH 1331 Project 1-Spring 2022
Please read through the instructions carefully.
I. Overview
In this project, you will practice applying the 5 steps of problem solving to an optimization
problem and manipulate vectors and matrices. You will also analyze real data, working step by
step to solve a problem that you will not have seen in your classes.
II. Guidelines
Question: What amount of “collaboration” with fellow students is allowed?
Answer: You are encouraged to verbally discuss the project with other students. You can
brainstorm together solution approaches, and you can teach each other how to do things in
MATLAB. Allowed collaboration ends with this verbal discussion. At no time can you copy
work others have done or have someone else do any of the work for you or do any of the work
for someone else. Everything in the script files must be your work, and your work alone. If you
need more help, ask your TA or instructor for assistance.
Question: Can I use MATLAB functions or operations we have not covered in class?
Answer: In this project you cannot use explicit loops (for, while, or if). Only MATLAB’s
implicit loops (array operations & intrinsic functions) are allowed. In addition, you cannot use
anything from the MATLAB toolboxes, e.g., the symbolic toolbox. Only the standard/basic
MATLAB package is allowed. You may, however, use any function described in the
instructions, such as legend and polyfit.
III. Procedure
Create a folder named uuuuuP1 where uuuuu are all the characters of your Student ID and name.
As you work on this project, save all the specified files in this folder. It should be set as your
current working directory as you work through each section.
Your folder should contain 3 different files which are the script files from section one,
section two, and section three. You do not need to put the text files in your submission
folder. When you are finished, you will compress the folder into a .zip file and submit it to
Blackboard Learn as instructed in the document.
Your .m files should be easy to read and include comments, blank lines, and section breaks
(%%) in a format comparable to what is shown below. You are also encouraged to pause your
code where appropriate.
Your code must be easy to follow in both the script file and the command window outputs.
All output answers should be formatted as part of a sentence in the command window, unless
stated otherwise.
Example formatting for .m files:
%% ENGI 1331H Project 1 – Your Name – Your Student ID
clc, close, clear
disp('ENGI 1331H Project 1 – Your name – Your Student ID')
disp(‘ ‘)
%% Section 1 – Title
disp(‘Section 1 – Title’)
disp(‘ ‘)
% Task 1.1 – Title
disp(‘Task 1.1 – Title’)
disp(‘ ‘)

disp(‘Press any key to continue’);
pause
Section 1: Vector and Matrix Manipulation
Avoid hardcoding! Your script should still work when checked with a different matrix!
Task 0
Open a new script file and name it Section1. Add the appropriate headers to your script file.
Task 1
Load the matrix, “Matrix_P1.txt”. Include a text output to inform the user that the matrix was
loaded.
Task 2
Display the number of rows and columns in the matrix. Your answer should appear as a
sentence.
Task 3
Display the 5
th row of the matrix.
Task 4
Display the value that is in the 3
rd row and last column.
Task 5
Display the values at the four corners of the matrix. The values should be displayed as a 2 by 2
matrix.
Task 6
Display the last value in each odd numbered column.
Task 7
Display the last value in each even numbered column of the transposed matrix.
Task 8
Display the maximum and minimum values of the matrix.
Task 9
Display the column number that contains the smallest value in the matrix.
Task 10
Display the row number that contains the largest value in the matrix.
Task 11
Knowing there is an odd number of rows and even number of columns, display the 2 center
values of the matrix.
Task 12
Display the row number with the smallest sum.
Task 13
Delete the last row and the last column from the matrix. Save the new matrix to the variable,
Small_Matrix.
Section 2: Optimization
In this section you will be solving an optimization problem similar to Project 4 from ENGI
1100H, however, you may not use apps to solve this problem. Use the 5 Steps of Problem
Solving to organize your script.
Task 0
Open a new script file and name it Section2. Add the appropriate headers to your script file.
Task 1
Your engineering class is raising money for an end of year beach retreat by selling t-shirts. You
must sell at least 200 t-shirts at a profit of $10/shirt to make enough money to go on the trip.
However, for every $0.50 that you lower the price of the shirts (and therefore, your profit per
shirt), you can expect to sell 20 more shirts above your 200 t-shirt minimum. Receiving more
profit will give your class spending money on this trip, where you can all collectively decide to
spend it on food, umbrella rentals, beach balls, or other items.
How many t-shirts and at what price will maximize your fundraiser profits?
Use the 5 Steps of Problem Solving in your solution and clearly comment your code. The final
number of t-shirts and profit per shirt to maximize your fundraiser profits should be displayed in
the command window as a formatted output to two decimal places. You should also create a
properly formatted plot named Figure 100 with a title that clearly communicates your answer.
Task 2
You are worried that your fundraiser will not make enough money for the class to go on the trip.
You asked around and your classmates are still willing to go on this trip even if they must pay
extra. However, as the amount of money each classmate must contribute increases, fewer
classmates are willing to go. This relationship is expressed as:
y = -0.02x²+ 62, x ≥ 0 and y > 0
Where y is the number of classmates that will pay extra to go on the trip despite x t-shirts less
than the minimum being sold. For this part of the problem, assume the shirts are sold at a profit
of $10/shirt and that you need $2000 to go on the trip.
Task 2.1
If you meet your fundraiser goal and make a profit of $2000, how many students will go on the
trip?
The final answer should be displayed in the command window as a formatted output to zero
decimal places. You cannot have a partial student!
Task 2.2
(a) For exactly 30 paying students to go on this trip, how many t-shirts would you have to sell
(b) For exactly 30 paying students to go on the trip, how much money was your fundraiser short?
(c) How much would each of the 30 students have to contribute to the trip if the cost (amount
after considering the profit raised) was split evenly?
The final answers should be displayed in the command window as a formatted output using the
appropriate number of decimal places for the value being reported. Avoid hardcoding! Your code
should be flexible if the number of paying students increases or decreases!
Task 2.3
Create a properly formatted plot named Figure 200 (Shirts sold vs. Students going on the trip)
with a title that clearly communicates your answer. The point that corresponds to 30 students
going on the trip should appear as a blue star.
Section 3: Data Manipulation
In this section you will be using MATLAB to manipulate and analyze real data from the bike
sharing program, Citi Bike, in New York City. The data you are using was collected over a 24-
hour period.
Task 0
Open a new script file and name it Section3. Add the appropriate headers to your script file.
Task 1
You will be working with the data contained in the file “IndRides.txt,” which contains
information about individual bike rides, all from a single day. The rides are listed in
chronological order, i.e. the first row is the first ride of the day and the last row point is the last
ride of the day. The data in the file is organized into three columns as shown below:
Duration Starting Station ID Bike ID
Duration: Duration of the bike trip in units of seconds
Starting Station ID: Bike rental station where the bike was checked out to begin riding
Bike ID: Bike that was used for the trip
Task 1.1
Load the data, “IndRides.txt”. Include a text output to inform the user that the data was loaded.
Task 1.2
How many bike trips were taken on this day?
Task 1.3
What was the average trip time in seconds? The time should be reported with 2 decimal places.
Task 1.4
Report the ID number of the bike that was used for the shortest trip and the starting station ID.
Task 1.5
Many bikes are used multiple times throughout the day by various riders. Ask the user to input a
valid Bike ID. Report back the total number of minutes that bike was used with 2 decimal
places.
Task 2
You will now use data contained in the file, RideTimes.txt to analyze Citi Bike usage at
different times throughout the day. The data file contains the number of bike trips that began in
successive 60-minute increments, starting at 12:00 AM and continuing until 11:59 PM. For
example, time = 60 minutes, corresponds to 12:00 AM – 12:59 AM, time = 120 minutes
corresponds to 1:00 AM – 1:59 AM, etc. The data in the file is organized into two columns as
shown below:
Time Number of Rides
Time: Time in units of minutes
Rides: Number of rides
Task 2.1
Load the data, “RideTimes.txt”. Include a text output to inform the user that the data was loaded.
Task 2.2
Plot the data in Figure 300 so that time is on the x-axis and the number of rides is on the y-axis.
The data should appear on a properly formatted plot. HINT: What type of plot should you use for
experimental (collected) data?
Task 2.3
Interpret your data: How can you explain the shape of the data? Why do you think there are 2
peaks in ridership at those specific times?
Task 2.4
Use the 3 data points immediately before and after the highest peak in ridership to find a
quadratic equation that predicts the number of bike rides based on the time of day for the peak
ridership period only. Your fit equation should be plotted as a thick, solid magenta line and
communicated with a legend on the same plot as Task 2.2. HINT: What type of plot should you
use for theoretical (equation) data?
Sample Plot Output:
Task 2.5
Compare your experimental and theoretical data: How many actual bike rides occurred between
8-8:59 AM (time = 540 minutes)? How many bike rides does your function predict?
Carefully review your work and make sure all tasks were completed
before submitting your project! Is your code flexible? Did you avoid
hardcoding?

联系我们 - QQ: 99515681 微信:codinghelp
© 2021 www.7daixie.com
程序辅导网!