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

The wind chill factor (WCF) measures how cold it feels with a given temperature

ID: 2081575 • Letter: T

Question

The wind chill factor (WCF) measures how cold it feels with a given temperature t [in degree Fahrenheit, F] and wind speed v [in miles per hour, mph]. For temperature t below 50 F and wind speed v higher than 3 mph, the WCF is calculated by WCF = 35.7 + 0.6t - 35.7v^0.16 + 0, 43tv^0.16 Write a function to receive the temperature and wind speeds as input arguments and return WCF When appropriate, your function should be able to accept t as a vector of temperatures, and v as a vector of wind speeds and returns a vector of WCFs. Your function should check for out of range inputs and return one of the following error messages when appropriate: When at least one of the input temperatures in t is 50 F or above, but all the input wind speeds are at least 3 mph, the function returns: 'At least one temperature is out of range When all the input temperatures in t are below 50 F but at least of wind speed in v is less than 3 mph, the function returns: "At least one wind speed is out of range When at least one of the input temperatures in t is 50 F or above and at least of wind speed in v is less than 3 mph, the function returns: "At least one temperature and one wind speed are out of range'

Explanation / Answer

This problem is solved by using nested if function and the calculation for wind chill factor function is to done element-wise as the inputs are vectors. The file name of the following code should be wcf.m used as it is also the function name. The matlab code for the wind chill factor is as follows:

function wcf(t,v);

if(t>=50 & v>=3)

disp('At least one temperature is out of range');

elseif(t<50 & v<3)

disp('At least one wind speed is out of range');

elseif(t>=50 & v<3)

disp('At least one temperature and one wind speed are out range');

else

wind_chill_factor=35.7+(0.6.*t)-(35.7.*power(v,0.16))+(0.43.*.*power(v,0.16));

end