Create a variable named dayTempsCHI and assign to it a vecto

Create a variable named dayTemps_CHI and assign to it a vector whose elements are the following daily temperatures (in degree F) recorded for Chicago in the month of August. [75 79 86 86 79 81 73 89 91 86 81 82 86 88 89 90 82 84 81 79 73 69 73 79 82 72 66 71 69 66 66] | Create a variable named dayTemps_SF and assign to it a vector whose elements are the following daily temperatures (in degree F) recorded for San Francisco in the month of August. [69 68 70 73 72 71 69 76 85 87 74 84 76 68 79 75 68 68 73 72 79 68 68 69 71 70 89 95 90 66 69] Determine how many days San Francisco\'s temperature was above average. Compute how many days Chicago\'s temperature was in the range [62 degree F, 78 degree F]. Compute how many days San Francisco\'s temperature was cooler than 72 degree F OR warmer than 80 degree F. Compute how many days Chicago\'s temperature was NOT between 70 degree F and 90 degree F, inclusive. Compute how many days San Francisco\'s temperature was NOT colder than 73 degree F AND NOT warmer than 89 degree F. Compute Chicago\'s temperatures that are warmer than 84 degree F but cooler than 90 degree F. Compute San Francisco\'s temperatures that are warmer than 65 degree F, cooler than 72 degree F, but NOT 69 degree F. Compute on which day(s) San Francisco\'s temperature was warmer OR the same as the temperature in Chicago? Compute on which day(s) the temperature was the same in both cities.

Solution

clc;

clear all;

close all;

%1

dayTemps_CHI=[75 79 86 86 79 81 73 89 91 86 81 82 86 88 89 90 82 84 81 79 73 69 73 79 82 72 66 71 69 66];

%2

dayTemps_SF=[69 68 70 73 72 71 69 76 85 87 74 84 76 68 79 75 68 68 73 72 79 68 68 71 70 89 95 90 66 69];

%3

average_dayTemps_SF=mean(dayTemps_SF)

%4

count=0;

for k=1:length(dayTemps_CHI)

k1=dayTemps_CHI(k);

if k1>62 && k1<78

count=count+1;

end

end

count

%5

count=0;

for k=1:length(dayTemps_SF)

k1=dayTemps_CHI(k);

if k1<72 || k1>80

count=count+1;

end

end

count

%6

count=0;

for k=1:length(dayTemps_CHI)

k1=dayTemps_CHI(k);

if ~(k1>=70 && k1<=90)

count=count+1;

end

end

count

OUTPUT

average_dayTemps_SF =
74.7333
count =
10
count =
21
count =
5
>>

 Create a variable named dayTemps_CHI and assign to it a vector whose elements are the following daily temperatures (in degree F) recorded for Chicago in the mo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site