Exercise (Lab Report 3)
1. Data set with 24 hourly values of dry-bulb and wet-bulb temperature and other
psychometrics data is given in data.txt. The first column is 24 hourly values, the second
column is dry-bulb temperature in C, the third column is wet-bulb temperature in C, the
fourth column is humidity ratio (H) and the fifth column is the relative humidity value
(RH%). Provide a code to load the data.xlsx set into MATLAB.
A=xlsread('data.xlsx')
2. Create a function to calculate the saturation vapor pressure, Ps.
function Ps= labreport_q2(T)
Tk=T+273.15;
R=2.21056e7;
A=-2.740553e4;
B=9.75413e1;
C=-0.146244;
D=0.12558e-3;
E=-0.48502e-7;
F=4.34903;
G=0.39381e-2;
x=A+B*Tk+C*Tk^2+D*Tk^3+E*Tk^4;
y=F*Tk-G*Tk^2;
Ps=R*exp(x/y);
3. Create a function to calculate the humidity ratio, H.
function H= labreport_q3(Twb,Hs,Tdb)
x=((2501-2.381*Twb)*Hs)-(1.006*(Tdb-Twb));
y=2501+1.805*Tdb-4.186*Twb;
H=x/y;
4. Create a function to calculate the partial vapor pressure, Pv.
function Pv= labreport_q4(H)
Patm=101000;
x=Patm*H;
y=0.6219+H;
Pv=x/y;
5. Create a script to plot the measured humidity ratio, H from the loaded data (blue circle)
and calculated humidity ratio, H in Exercise 3 (red line) against time on the same plot.
Label the graph correctly and give a brief comment on the results.
(Hint: Use for loop in your script)
numericaldata=xlsread('data.xlsx')
Hr=numericaldata(:,4)
T=numericaldata(:,1)
Tdb_exp=numericaldata(:,2)
Twb_exp=numericaldata(:,3)
for i=1:24
Tdb=Tdb_exp(i)
Twb=Twb_exp(i)
P=101000
Pswb=labreport_q2(Twb)
Hs=(0.6219*Pswb)/(P-Pswb)
H(i,1)=labreport_q3(Twb,Hs,Tdb)
End
figure(1)
plot(T,Hr)
hold on;
plot(T,H,'sr')
xlabel('Time taken(hour)')
ylabel('Humidity')
title('Humidity against Time taken')
Humidity against Time taken
0.019
H
Hcal
0.0188
0.0186
Humidity
0.0184
0.0182
0.018
0.0178
0.0176
10
Time taken(hour)
15
20
25
6. Create a script that plot the calculated Ps, Pv and RH against time on the same plots. Add
the measured RH data (blue square) vs. time on the same plot as well to check the
accuracy of the used model. Use double Y axis plot if necessary. Label your graph
correctly. Give a comment on your results. (Hint: Use for loop in your script)
numericaldata = xlsread('data.xlsx');
T = numericaldata(:,1);
Twb1 = numericaldata(:,3);
H1 = numericaldata(:,4);
RH1 = numericaldata(:,5);
for i=1:24;
Twb = Twb1(i);
H = H1(i);
Ps(i,1) = labreport_q2(Twb);
Pv(i,1) = labreport_q4(H);
RHcal(i,1) = Pv(i)/Ps(i);
end
plot(T,Ps,'r')
hold on
plot(T,Pv,'g')
hold on
plot(T,RH1,'m')
hold on
plot(T,RHcal,'bs')
xlabel('Time')
ylabel('Ps,Pv,RH,RHcal')
title('Time Against Saturated Pressure, Vapor Pressure, Humidity Ratio and
Calculated Humidity Ratio')
legend('Ps','Pv','RH','RHcal')
Time Against Saturated Pressure, Vapor Pressure, Humidity Ratio and Calculated Humidity Ratio
3500
Ps
Pv
RH
RHcal
3000
Ps,Pv,RH,RHcal
2500
2000
1500
1000
500
10
Time
15
20
25