Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. (6 points) Matrix Problem Generate a matrix of random integer temperatures in

ID: 3863846 • Letter: 2

Question

2. (6 points) Matrix Problem Generate a matrix of random integer temperatures in Fahrenheit from 70 to 100 for 10 weeks (rows) and 7 days per week (columns). The result should look something like this. Assume the first column is Monday, etc. temperatures 96 80 75 83 73 83 95 71 95 88 86 79 77 70 75 77 87 86 98 78 98 98 98 75 95 80 78 74 88 95 96 76 93 87 78 86 96 77 93 84 90 100 89 81 70 91 72 78 87 74 87 80 93 83 Write Matlab code to answer the following questions 2a. Which day (1 through 7) had the highest average temperature, and what was that average temperature? 2b. How many days over 90 degree are there? 2c. Which week number had the most temperatures less than 75 degrees

Explanation / Answer

temp = randi([70 100],10, 7);

day = find(mean(temp) == max(mean(temp)));
fprintf("Day with max avg temp is: %d, temperature: %d ",day,max(mean(temp)));

fprintf("%d days with temp more than 90 ",sum(sum(temp>90)));
fprintf("Week(s) with most temp less than 75 is");
disp(find(sum(temp'<75) == max(sum(temp'<75))))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote