Assignment
ML-2: Intermediate Level Matlab
Practice with Logic!
General Program Requirements:
• Proper planning using pseudo code or flow chart
• Top-of-programs contain comment that includes: author’s name & date
• Comments at appropriate points in code!
Problem 1 - “Largest and Smallest Numbers”
Write a program that loads a 6 x 24 a
ay of integers from a data file and then outputs the largest and the smallest values for
each row onto the console in a full sentence. You may not use the built-in max and min functions. Start by creating a flowchart
or pseudo code in a computer program (draw.io or other.) The input file is on Canvas.
Input File Name: Largest_and_Smallest_Numbers.txt
Name your file: LastName_ML2_L2S.m
Your output should look like this:
Screen shot your finished command prompt
Problem 2 – “Sutures”
Sutures are strands or fibers used to sew living tissue together after an injury or an operation. Packages of sutures must be
sealed carefully before they are shipped to hospitals to prevent contamination. The packages are sealed on a machine with
a sealing die. For the sealing to be a success, the die must be maintained at an established temperature, and contact the
package with a predetermined pressure for an established time period. This time period is called the dwell time. The
acceptable ranges for these three conditions are as follows:
Temperature: XXXXXXXXXX° C
Pressure: 60-70 psi
Dwell Time: 2-2.5 sec
Write a program that reads in a file containing data of 24 batches of rejected sutures. Start by creating a flowchart or pseudo
code in a computer program (draw.io or other.)
Input File Name: Batch_Data.txt
Each line of the file contains a batch number, temperature, pressure and dwell time for a batch. As the Quality Control
Engineer, you need to analyze the data and compute:
• Number of batches rejected due to temperature, pressure, and dwell time.
• Percent of batches rejected due to temperature, pressure, and dwell time.
• Total number and Percent of failed batches.
If a specific batch was rejected in more than one category, it should be counted in all of the applicable totals. Any failure in
a specific category counts as a specific category failure and also makes the batch fail overall. However, do not ‘double
count’ batch failures, if a batch fails for more than one reason.
Name your file: LastName_ML2_Sutures.m
Your output should look like this:
Screen shot your finished command prompt
Create a PDF containing:
• Both flow charts/ pseudo code
• Both screenshots (make sure to label all your screenshots/figures!)
RUBRIC
Points
Upload ALL files to Canvas with co
ect names.
(1 PDF + 2 .m files) 5
Program 1: Largest to Smallest
File runs without e
ors and returns co
ect values. 15
Has a clean formatting in command prompt 5
Is commented with clear comments that help the user understand
the logic of this code. Contains name and date. 10
Included a flow chart or pseudo code 5
Screen shot of finished command prompt 5
Program 2: Sutures
File runs without e
ors and returns co
ect values. 30
Has a clean formatting in command prompt 5
Program Clarity
• Commented with clear comments that help the user
understand the logic of this code
• First comments contain student’s name and date.
• Formatted appropriately (indentations/parentheses)
10
Included a flow chart or pseudo code 5
Screen shot of finished command prompt 5
Total 100
BONUS CHALLENGE (WORTH 3 POINTS IF SUCCESSFUL)
The following challenge is optional for students looking to
challenge themselves.
• Change Problem #2 to track the ID# of the failed
atches
• Print the failed batches to the screen in rows of 5 (get
creative!)
• Save the file as LastName_ML2_Bonus.m and upload
this in place of sutures
• Your new command prompt should look like this:
ML-2: Intermediate Level Matla
Practice with Logic!
982 975 65 1174 696 730 422 1840 1925 469 1344 16 476 1057 144 1908 1740 981 959 1836 1055 1915 1113 347
97 1491 1269 1326 1019 1504 38 463 208 898 1028 344 889 185 232 1729 37 924 1218 1260 806 1239 283 1821
60 1445 672 1620 1309 1174 123 1630 957 1711 643 424 1406 1420 1400 798 853 1616 597 232 1544 1629 1423 818
1677 1708 1201 685 1519 1395 1909 1385 1690 1074 1729 279 1774 526 1284 540 1579 75 1049 1624 5 407 715 203
628 1185 870 1280 329 1994 1015 398 1913 70 420 576 867 1733 8 1795 500 594 304 158 1932 1534 921 1911
1954 1700 502 1048 3 690 883 434 1525 1853 1000 832 1573 1064 1804 1240 1614 1147 805 390 1538 127 1908 1947
24551 145.5 62.3 2.13
24582 153.7 63 2.52
26553 160.4 58.8 2.51
26613 159.5 58.9 2.02
26624 160.5 61.5 1.98
27725 170.9 62.5 2.03
27832 147.8 65.6 2.12
27976 155.4 71 2.34
28061 162.7 57.9 2.61
28251 171.3 59.2 2.23
28347 164.8 65 2.45
28782 152.8 58.6 2.05
28788 167.2 67.3 1.89
29192 149.6 60.9 2.26
29227 172 67.8 2.33
29482 155.2 73.1 2.47
29522 148.5 72.1 2.27
29617 168.3 49.7 2.63
29785 169.4 64.4 1.87
29885 146.6 55.9 2.42
29943 170.3 66.8 2.31
29957 166.3 56.8 2.11
29968 162.8 64.6 2.68
29987 149.2 69.7 2.22