4 Functions [10 marks]
Humidex is an index to indicate how hot the weather feels to the average person when there is some humidity. For example, if the temperature on a humid day is 30 degrees and the Humidex is 40 then it means that it feels similar to a dry day where the temperature is 40 degrees. The Humidex formula used by Environment Canada when the air temperature in degrees Celcius is \(T_a\) and the dewpoint temperature in degrees Celcius is \(T_d\) is:
\[ T_h = T_a + 0.5555\left(6.11 e^{x}-10\right) \]
where \(x = 5417.7530\left(\dfrac{1}{273.15}-\dfrac{1}{T_d + 273.15}\right)\) and \(T_h\) is the Humidex value.
Create a function that computes the Humidex value. Your function should satisfy the following constraints:
- it should be named
humidex
- it should return one value
Th
(the Humidex value) - it should have two input values
Ta
andTd
(the air temperature and dewpoint temperature in degrees Celcius)
Note that the MATLAB function exp
will compute \(e\) raised to a specified exponent.
4.1 Example usage
The exact value of h
in the example below is not given to you, but it is between 30
and 35
:
airTemp = 25.5;
dewpoint = 18.2;
h = humidex(airTemp, dewpoint)