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

A file named temp.txt contains temperature information collected from a set of t

ID: 3559637 • Letter: A

Question

A file named temp.txt contains temperature information collected from a set of thermocouples. The data in the file are shown in the table below. The first column consists of time measurements (one for each hour of the day), and the remaining columns correspond to temperature measurements at different sensors in an industrial plant.

(a) Write a Matlab program that prints the index numbers (rows and columns) of temperature data values greater than 85.0.

(b) Find the index numbers (rows and columns) of temperature data values less than 65.0.

(c) Find the maximum and minimum temperatures in the file and the corresponding hour and sensor number.

(d) What percentage of the temperature readings at each sensor lies between 65.0 and 85.0?

Temperature Data

Hour Sensor 1 Sensor 2 Sensor 3

01 68.70 58.11 87.81

02 65.00 58.52 85.69

03 70.38 52.62 71.78

04 70.86 58.83 77.34

05 66.56 60.59 68.12

06 73.57 61.57 57.98

07 73.57 67.22 89.86

08 69.89 58.25 74.81

09 70.98 63.12 83.27

10 70.72 64.00 82.34

11 69.44 64.77 80.21

12 72.18 55.04 69.96

13 68.24 61.01 70.53

14 76.55 61.19 76.26

15 69.59 54.96 68.14

16 70.34 56.29 69.44

17 73.20 65.41 94.72

18 70.18 59.34 80.56

19 69.71 61.95 67.83

20 67.50 60.44 79.59

21 70.88 56.82 68.72

22 65.99 57.20 66.51

23 72.14 62.22 77.39

24 74.87 55.25 89.53

PLEASE SHOW OUTPUT

Explanation / Answer

CODE

a=textread('temp.txt');
s=size(a);
% Find temperature greater than 85
fprintf('Index numbers of temperature values greater than 85.0 ');
for i=1:s(1)
for j=2:s(2)
if a(i,j)> 85.0
fprintf('Row= %d ; Column=%d Temp=%0.2f ', i,j,a(i,j));
else
end
end
end

% Find temp less than 65
fprintf('Index numbers of temperature values less than 65.0 ');
for i=1:s(1)
for j=2:s(2)
if a(i,j)< 65.0
fprintf('Row= %d ; Column=%d Temp=%0.2f ', i,j,a(i,j));
else
end
end
end

% Maximum temperature
a_t=a(:,2:4);
mx=max(max(a_t),[],2);
for i=1:s(1)
for j=1:s(2)-1
if a_t(i,j)== mx
fprintf('Maximum temp= %0.2f, Hour=%d, Sensor=%d ',mx,a(i,1),j+1);
else
end
end
end

% Minimum temperature
mn=min(min(a_t),[],2);
for i=1:s(1)
for j=1:s(2)-1
if a_t(i,j)== mn
fprintf('Minimum temp= %0.2f, Hour=%d, Sensor=%d ',mn,a(i,1),j+1);
else
end
end
end

% Percentage temperature
count=zeros(1,3);
for i=1:s(1)
for j=1:s(2)-1
if a_t(i,j)>= 65.00 && a_t(i,j)<85.00
count(1,j)=count(1,j)+1;
else
end
end
end
for i=1:3
fprintf('At sensor= %d , Percent of tem between 65 and 85 is= %0.2f ',i+1, count(1,i)./s(1)*100);
end

RESULT

Index numbers of temperature values greater than 85.0
Row= 1 ; Column=4 ; Temp=87.81
Row= 2 ; Column=4 ; Temp=85.69
Row= 7 ; Column=4 ; Temp=89.86
Row= 17 ; Column=4 ; Temp=94.72
Row= 24 ; Column=4 ; Temp=89.53


Index numbers of temperature values less than 65.0
Row= 1 ; Column=3 ; Temp=58.11
Row= 2 ; Column=3 ; Temp=58.52
Row= 3 ; Column=3 ; Temp=52.62
Row= 4 ; Column=3 ; Temp=58.83
Row= 5 ; Column=3 ; Temp=60.59
Row= 6 ; Column=3 ; Temp=61.57
Row= 6 ; Column=4 ; Temp=57.98
Row= 8 ; Column=3 ; Temp=58.25
Row= 9 ; Column=3 ; Temp=63.12
Row= 10 ; Column=3 ; Temp=64.00
Row= 11 ; Column=3 ; Temp=64.77
Row= 12 ; Column=3 ; Temp=55.04
Row= 13 ; Column=3 ; Temp=61.01
Row= 14 ; Column=3 ; Temp=61.19
Row= 15 ; Column=3 ; Temp=54.96
Row= 16 ; Column=3 ; Temp=56.29
Row= 18 ; Column=3 ; Temp=59.34
Row= 19 ; Column=3 ; Temp=61.95
Row= 20 ; Column=3 ; Temp=60.44
Row= 21 ; Column=3 ; Temp=56.82
Row= 22 ; Column=3 ; Temp=57.20
Row= 23 ; Column=3 ; Temp=62.22
Row= 24 ; Column=3 ; Temp=55.25


Maximum temp= 94.72, Hour=17, Sensor=4
Minimum temp= 52.62, Hour=3, Sensor=3


At sensor= 2 , Percent of tem between 65 and 85 is= 100.00
At sensor= 3 , Percent of tem between 65 and 85 is= 8.33
At sensor= 4 , Percent of tem between 65 and 85 is= 75.00

And download the code from here-

https://drive.google.com/file/d/0B8147JTJADX4Vmd6Zi1ReHlfaFk/edit?usp=sharing

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