% Compute wind chill, plot graphs, two different ways query = input('Would you like to see wind-chill graphs?','s'); if query == 'y' | query == 'Y' % Display the graphs t = -100:3:0; v = 0:3:100; [t,v] = meshgrid(t,v); wc1 = 35.74 + (0.6215*t) - (35.75*v.^(0.16)) + 0.4275*t.*v.^(0.16); wc2 = 0.0817*(t-91.4).*(3.71*v.^(0.5)+5.81-0.25*v)+91.4; % First graph %mesh(t,v,wc1); %contour(t,v,wc1); %meshc(t,v,wc1); surf(t,v,wc1); xlabel('Temperature'); ylabel('Wind Speed'); zlabel('Wind Chill'); title('Wind Chill New'); % Second figure(2); %mesh(t,v,wc2); %contour(t,v,wc2); %meshc(t,v,wc2); surf(t,v,wc2); xlabel('Temperature'); ylabel('Wind Speed'); zlabel('Wind Chill'); title('Wind Chill Old'); else t = input('Temperature='); while t < 100 if t <= 30 v = input('Wind Speed='); wc1 = 35.74 + (0.6215*t) - (35.75*(v^(0.16))) + 0.4275*t*(v^(0.16)); wc2 = 0.0817*(3.71*(v^(0.5)) + 5.81 - 0.25*v)*(t - 91.4) + 91.4; out = strcat('Wind Chill: new=', int2str(round(10*wc1)/10), ' old=',num2str(round(10*wc2)/10)); disp(out); if wc1 > 10 disp('Caution - no shorts allowed'); elseif wc1 > -20 disp('Extreme caution - take a trip to Florida'); elseif wc1 > -40 disp('Moderate danger - Frostbite possible'); else disp('Extreme danger - Do not bother leaving bed'); end else disp('Too warm for wind chill'); end t = input('Temperature='); end end