matlab留学生作业代做,代写Canvas留学生作业、MatLab编程语言作业调试、MatLab实验作业代做、代写program课程作业...
代写Canvas留学生作业、MatLab编程语言作业调试、MatLab实验作业代做、代写program课程作业
日期:2019-12-07 10:14
Your CRN or Class ID: _________________ Your Name:____________________________
MatLab Take-Home Test
(Take-Home Tests, Strictly Individual, 50 Points)
This is a take-home test, meaning that you may use course-provided materials or outside references as study
aids. However, you may NOT copy solutions from the Internet or another student and submit them as
your own work. Be sure to read and sign the Honor Pledge at the bottom of this page.
You must return this page to your instructor in person to receive credit for this assignment. Grades will be
posted on Canvas as usual.
Please print your name and CRN or Class ID at the top and bottom of this page.
There are two problems in this assignment. The second problem uses an external data file. The data file can be
found on the Canvas home page, and is named as TravelingTrucks_Coordinates.csv. A version of this file with
headers is also available on the Canvas home page for reference.
SAVE YOUR FILES OFTEN – If MatLab crashes, you won’t lose all of your work.
HONOR PLEDGE:
I have neither given or received unauthorized aid on this assignment, including solutions to assignment problems
obtained from other students or the Internet. I will not share or make available in any way any information about
this assignment to anyone until after the graded assignment has been returned to me.
SIGNATURE: _______________________________________________________________________
Printed Name (Last, First):_____________________________________________________________
Your CRN or Class ID: _________________ Your Name:______________________
Problem 1
Part 1:
Create a MatLab script file funcVector_pid.m which accepts two vectors: names of marathon runners, and
their respective finish time from the user, and then outputs the name of the winner and his/her finish time. For
this problem, do not use loops. The user creates the names of the runners and their finishing times.
Hint: https://www.mathworks.com/help/matlab/ref/min.html
Submit the following to the Canvas site for this test as follows:
? A pdf including:
o Listing of the code for your program
o Screen shot showing results
? Your .m file for the code.
Be sure to label all files with your PID, and NOT with your numeric ID.
Part 2:
Write a MATLAB script file named vectorPattern_pid.m that will:
1. create a vector for a variable A with value [-99 -98 -97 . . . . -1]
2. using the vector A, create a second vector B which has the same numbers as A at its even indexes, but
the numbers at odd index values are replaced by the value 0.
3. Starting from the index value 16, replace every 5th element of vector B with the value 100
4. Multiply each element of B with the value -3
5. Display only the 29th – 50th elements of B.
Submit the following to the Canvas site for this test as follows:
? A pdf including:
o Listing of the code for your program
o Screen shot showing results
? Your .m file for the code.
Be sure to label all files with your PID, and NOT with your numeric ID.
Problem 2
A local manufacturing company wants to find out the total time it takes to
deliver its products to retail stores from its manufacturing plant. The company
has 2 delivery trucks for this purpose. Truck 1 can travel at a speed of 54
km/hr and truck 2 can travel at 28 km/hr. The trucks go from store to store
delivering the products and then the trucks return to the factory. All deliveries
have been made.
The locations of the retail stores are given as a set of kilometers west/east and
north/south. For example, (0, -15) means that the truck is only moving south 15 km or (-10, 30) means that the
truck is moving west 10 km and north 30 km. The trucks depart from the factory at the same time and travel from
one store to another until they eventually return to the original starting point. Make sure to account for the distance
needed to travel back to the starting point/factory. Each coordinate set is the distance from a starting point to
a destination.
(Northwest) (Northeast)
Southwest) (Southeast)
Part 1:
Download the file named TravelingTrucks_Coordinates.csv and save it in your MatLab folder. This file can be
found on the Canvas home page.
Part 2:
Write a MATLAB script that does the following:
1. Reads in the data from TravelingTrucks_Coordinates.csv. The file will contain 4 columns:
a. Column 1: Truck 1 west/east
b. Column 2: Truck 1 north/south
c. Column 3: Truck 2 west/east
d. Column 4: Truck 2 north/south
2. Outputs to travelingtrucks.txt, the total distance and time covered by both trucks for the full trip, both
individually and combined. The distance value should be in kilometers and accurate to two decimal
places (e.g., 1.34 km). Make sure to account for the distance needed to travel back to the starting
point/factory. You might use fopen/fclose or writematrix to write your results to a file.
3. To the same txt file, outputs which truck arrives back to the factory first.
4. Generate a single plot showing the paths traveled by both trucks.
NOTE: you can use the Pythagorean theorem ( a2
+ b2
= c2.) to calculate the straight-line distance of a given
store from another location, such as the warehouse or another store.
Submit the following to the Canvas site for this test as follows:
? A pdf including:
o Listing of the code for your program
o Sample run (aka information in txt file)
o Screen shot of the plot
? Your .m file for the code.
? The .txt file containing your output.
Be sure to label all files with your PID, and NOT with your numeric ID.
Please see the next page for an example of the inputs and outputs for Problem 2 using different data.
Example Input and Output: DEMONSTRATION ONLY – NOT THE CORRECT SOLUTION TO
THIS PROBLEM
Truck 1 Speed: 40 km/hr
Truck 2 Speed: 70 km/hr
Sample Input for truck 1 Sample Input for truck 2
Sample Output
Total distance travelled by truck 1: 169.50 km
Total time travelled by truck 1: 4.24 hours
Total distance travelled by truck 2: 117.51 km
Total time travelled by truck 2: 1.68 hours
Total combined distance travelled by the trucks: 287.01 km
Total combined time travelled by the trucks: 5.92 hours
East/West North/South East/West North/South
0 0 0 0
20 0 -20 0
30 -15 -30 -15
15 40 -10 -10
-10 30 0 -30
-20 5 10 -10
0 0 0 0