MATBLAB PROBLEM For this problem create a function that calc
MATBLAB PROBLEM
For this problem, create a function that calculates matrices of the outdoor football pressure for the full range of indoor and outdoor temperature conditions when the football is filled to 12.5, 13 and 13.5 psi using nested loops. (Note: to facilitate this, you may run your function 3 separate times, one for each of the pressure to which the ball is filled). The inputs of your function should be the indoor pressure as a vector; lower indoor temperature, upper indoor temperature, indoor temperature increment, lower outdoor temperature, upper outdoor temperature and outdoor temperature increment all as scalars. You may use for, while or if loops in your nested loop structure as you see fit. Save your file as NFL_BRADYCHEATS(Your initials).m. Show that your code works by inputting the values given in the problem statement above into your function via the Command Window. Is it physically possible for the pressure in the football to drop below regulation pressure when it’s filled in a “warm” room and taken into the cold air during a football game.
Solution
function y=outdoorpressure(ind_pres,ind_temp_low,ind_temp_upp,ind_inc,out_temp_low,out_temp_upp,out_inc)
% for each pressure
for temp_i=ind_temp_low:ind_temp_upp
for temp_o=out_temp_low:out_temp_upp
%outdoor pressure calculation
out_pres=ind_pres(1)*(temp_o/temp_in)
end
end
for temp_i=ind_temp_low:ind_temp_upp
for temp_o=out_temp_low:out_temp_upp
%outdoor pressure calculation
out_pres=ind_pres(2)*(temp_o/temp_in)
end
end
for temp_i=ind_temp_low:ind_temp_upp
for temp_o=out_temp_low:out_temp_upp
%outdoor pressure calculation
out_pres=ind_pres(3)*(temp_o/temp_in)
end
end
end
