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

USE MATLAB TO ANSWER: Write a function file called Delta_q.m that calculates the

ID: 3721594 • Letter: U

Question

USE MATLAB TO ANSWER:

Write a function file called Delta_q.m that calculates the value of the function delta q defined in Appendix C.

• There should be 4 inputs to Delta_q.m: the values of T , atmospheric temperature Ta, dew point Td, and atmospheric pressure pa.

• There should be 1 output from Delta_q.m: the value of delta q (T, Ta, Td, pa).

• Be sure to include comments describing the function and its inputs and output.

Appendix C - Wetbulb Temperature As explained by Dr. Colby, wetbulb temperature is the temperature a parcel of air can be cooled to by evaporating water into it at constant pressure. Given the air temperature Ta (K), the dew point Td (K), and the atmospheric pressure pa (hectopascals), the wetbulb temperature can be calculated by finding the root of the function Aq given by 1 + w2 where cp 1005 J/(kg K) is the heat capacity of water vapor; L 2.501 x 10 J/kg is the latent heat of water vapor at 0°C; wi denotes the mixing ratio corresponding to temperature Ta and pressure pa, and w2 denotes the mixing ratio corresponding to temperature T and pressure a. Use your function mixing-ratio to calculate w and w2. The units of T are degrees K

Explanation / Answer

PLEASE CREATE Delta_q.m AND PASTE BELOW CODE

function delta_q = Delta_q(T,Ta,Td,pa)
Ta = Ta + 273;
Td = Td + 273;

Tad = [Ta Td]; %creating interval of Ta and Td

%given values
L = 2.501 * 10^6; %J/kg
cp = 1005; %J/(kg K);


%use w1 and w2 values from mixing_ratio. I dont have value of w1 and w2
%for w1
p0 = 1013.246;
T0 = 373.16;
a1 = 11.344 * (1-Td/T0);
a2 = -3.49149 * (T0 / (Td-1));
b1 = -7.90298 * (T0/(Td-1));
b2 = 5.02808 *log10(T0/Td);
b3 = -1.3816 * (10^a1 - 1) / 10^7;
b4 = 8.1328 * (10^a2 - 1) / 10^3;
b5 = log10(p0);
b = b1+b2+b3+b4+b5;

pv = 10^b;
w1 = (0.62197 * pv) / (pa - pv);

%for w2
%Temperature T and pressure pa

a1 = 11.344 * (1-T/T0);
a2 = -3.49149 * (T0 / (T-1));
b1 = -7.90298 * (T0/(T-1));
b2 = 5.02808 *log10(T0/T);
b3 = -1.3816 * (10^a1 - 1) / 10^7;
b4 = 8.1328 * (10^a2 - 1) / 10^3;
b5 = log10(p0);
b = b1+b2+b3+b4+b5;

pv = 10^b;
w2 = (0.62197 * pv) / (pa - pv);


%given expression
delta_q = L * (w2 - w1) /(1 + w2) - (cp * (Ta - T)*(1 + 0.8*w2));

%evaluate for T
delta_q = fzero(delta_q, Tad);  
end

PLEASE PASS THE REQUIRED DATA TO FUNCTION AS I DON'T HAVE ANY DATA TO INPUT AND LET ME KNOW FOR RESULTS IN COMMENTS SECTION