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

Temperature data T (in Fahrenheit) for a city for the years 2003–2005 recorded o

ID: 3695391 • Letter: T

Question

Temperature data T (in Fahrenheit) for a city for the years 2003–2005 recorded over the first six months of each year are given below.

month 2003 2004 2005

------------------------------

1 28 38 39

2 25 29 24

3 50 53 52

4 61 60 62

5 67 61 68

6 74 78 88

a. Enter the 6×3 matrix of levels by hand into MATLAB. Then, with at most two MATLAB commands determine the months and years that have recorded temperatures T > 37. Print your results in the form of a table.

b. With a single command, calculate the average temperatures over the 6-month period recorded at each of the three years (1 × 3 array). With a single command calculate the average temperature averaged over the three years for each month (8 ×1 array).

Explanation / Answer

a = [28,38,39;25,29,24;50,53,52;61,60,62;67,61,68;74,78,88];
b = find(a>37);
[i,j] = ind2sub([6,3],b);
for rk = 1:size(i)
disp([num2str(i(rk))," ",num2str(j(rk))]);
end
mean_col = mean(a);
disp(mean_col);
mean_row = mean(a,2);
disp(mean_row);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote