Write a function file called mixing ratio.m that calculates the mixing ratio for
ID: 3198594 • Letter: W
Question
Write a function file called mixing ratio.m that calculates the mixing ratio for air as described in Appendix B * There should be 2 inputs to mixing ratio.m: temperature T and pressure p There should be 1 output from mixing ratio.m: the value of the mixing ratio w for the given values of T and p * Be sure to include comments describing the function and its inputs and output Appendix B Mixing Ratio The mixing ratio w is the ratio of the mass of water vapor to the mass of dry air. The mixing ratio corresponding to air temperature T and air pressure p is calculated as follows: 0.62197 pe P -Pe where py denotes vapor pressure. Th T as follows: e vapor pressure is calculated in terms of air temperature Pe = 10° where Po = 1013.246 10-373, 16 a, = 11.344 (1-T/10) Oz -3.49149(TO/T-1) bi = -7.90298 (T/T-1) bz = 5.0280810810 (T/T) b13816 (10 -1)/10 ba = 8.1328 (10"2-1)/103 bslogio(Po) andExplanation / Answer
function w = mixing_ratio(P,T) %function mixing_ratio has 2 inputs P in millibars and T in K
Po = 1013.246;
To = 373.16;
a1 = 11.344*(1-T/To);
a2 = -3.49149*(To/T - 1);
b1 = -7.90298*(To/T - 1);
b2 = 5.02808*log10(To/T);
b3 = -1.3816*(10^a1 -1)/(10^7);
b4 = 8.1328*(10^a2 -1)/(10^3);
b5 = log10(Po);
b = b1 + b2 + b3 + b4 + b5;
Pv = 10^b;
w = 0.62197*Pv/(P - Pv);
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.