The wind chill factor WCF measures how cold it feels with a

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 t below 50 F and v higher than 3 mph, the WCF is calculated by WCF = 35.7 + 0.6*t - 35.7*v^(0.16) + 0.43*t*v^(0.16). Write a function to receive the temperature and wind speeds as input arguments and return WCF. When appropriate, your function should accept vectors of temperatures and wind speeds and returns 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 t > 50 F but all v >= 3 mph, the function returns: \'At least one temperature out of range\'. When all t

Solution

function WCF = WindChill(t,v)
WCF = t;
if t>50 && v>=3
WCF = \'At least one temperature out of range\';
elseif t<=50 && v<3
WCF = \'At least one wind speed out of range\';
elseif t>50 && v<3
WCF = \'At least one temperature and wind speed out of range\';
else
WCF = 35.7+(0.6*t)-(35.7*v^0.16)+(0.43*t*v^(0.16));
end
end

Command window output:

>> WindChill(60,4)

ans =

At least one temperature out of range

>> WindChill(40,2)

ans =

At least one wind speed out of range

>> WindChill(60,2)

ans =

At least one temperature and wind speed out of range

>> WindChill(40,6)

ans =

35.0580

>>

 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 t be

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site