File name : calculateTemp.m
FahrShadeTemp_ip=[34,35,29,31,28,30,32,28,29,33]; %input array of temp in F
windchill_ip=[0]; %TEST 1 - no windchil
res1=WeatherTemp(FahrShadeTemp_ip,windchill_ip); %function call
disp('celshadetemp (no wind chill)')
disp(round(res1)) % temp in celcius without windchill
windchill_ip=[1]; %TEST 2 - with wind chill
res2=WeatherTemp(FahrShadeTemp_ip,windchill_ip); %function call
disp('celfeelsliketemp (with wind chill)')
disp(round(res2)) %temp in celcius with windchill
%Function definition
function CelFeelsLikeTemp=WeatherTemp(FahrShadeTemp,windchill)
if windchill[0]==1;
f=FahrShadeTemp-7; %subtract 7 from temp
CelFeelsLikeTemp=(f-32)/1.8; %convert to celcius
else
CelFeelsLikeTemp=(FahrShadeTemp-32)/1.8; %convert to celcius
end
end
OUTPUT:
In the command window type the file name calculateTemp. This will execute the file and display results.
Without rounding off the values to the nearesrt integer:
Rounding off the values to the nearest integer:
ALL THE BEST :D
ENR-125 Midtem Project 03 05/19 Write a function caled WeatherTemp which inputs °F shade-temp dat...