Create a variable named dayTemps_CHI and assign to it a vector whose elements ar
ID: 2319283 • Letter: C
Question
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 F1. 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 73Explanation / Answer
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
>>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.