final_exam - City.') disp(' ') fprintf('January%6.0f\n',...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Jeremy Debruce % December 1, 2008 % This program will Compare the temperatures in two cities in one month. % Defined variables clear,clc TNY = [31 26 30 33 33 39 41 41 34 33 45 42 36 39 37 45 43 36 41 37 32 32 35 42 38 33 40 37 36 51 50]; TANC= [37 24 28 25 21 28 46 37 36 20 24 31 34 40 43 36 34 41 42 35 38 36 35 33 42 42 37 26 20 25 31]; % Average Temperature for each city in a month. AveofTNY = mean(TNY) AveofTANC= mean(TANC) % The day Temperature was below average in both cities TNYbelowAve = TNY<= AveofTNY; NdaysTNYbelowAve = sum(TNYbelowAve) % Anchorage TANCbelowAve = TANC<= AveofTANC; NdaysTANCbelowAve = sum(TANCbelowAve) disp(' ') % How many days, and which dates in the month, was the temperature the in % Anchorage higher than the temperature in New York. TANChigher = TANC>TNY; NdaysTANChiger = sum(TANChigher) datesTANChigher = find(TANC>TNY); disp('These are the dates that Anchorage''s temperature was higer than New York
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: City.') disp(' ') fprintf('January%6.0f\n', datesTANChigher) disp(' ') % How many days, and which dates in the month, was the temperature the same % in both cities. Tempequal = TANC==TNY; Ndaysequal = sum(Tempequal) datesequal = find(TANC==TNY); disp('These are the dates that the temperature was the same in both cities.') disp(' ') fprintf('January %6.0f', datesequal) disp(' ') % How many days, and which dates in the month, was the temperature in both % cities above freezing (above 32degress F) TNYabove32_TANCabove32 = (TNY&gt;=32 &amp; TANC &gt; 32); NdaysTNYabove32_NdaysTANCabove32 = sum(TNYabove32_TANCabove32) disp('These are the dates the temperature was above freezing in New York City.') disp(' ') datesTNYabove32_TANCabove32 = find(TNY&gt;32 &amp; TANC &gt; 32); fprintf('January %6.0f\n', datesTNYabove32_TANCabove32) disp(' ') d...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 1200 taught by Professor Staff during the Spring '11 term at Kennesaw.

Ask a homework question - tutors are online