Question

Arrays: City temperatures The maximum daily temperatures (in C) for Istanbul and Ankara during August 2019 are given below.
Current Fold WNH importfile. m x + ç function importfile(fileToReadi) %IMPORTFILE(FILETOREAD1) 1% Imports data from the speci
0 0
Add a comment Improve this question Transcribed image text
Answer #1

%t_Ank = [33,30,31,32,33,35,30,29,29,28,29,30,32,32,33,32,34,31,33,30,29,30,31,33,31,30,27,26,27,26,27];
%t_Ist = [35,32,32,31,34,30,29,32,34,35,36,35,34,32,33,33,34,35,35,34,32,30,30,29,28,31,32,30,32,32,29];

%finding mean of the data provided
mean_Ank = mean(t_Ank);
mean_Ist = mean(t_Ist);

%finding maxium of the data provided
max_Ank = max(t_Ank);
max_Ist = max(t_Ist);

fprintf('The monthly max temperature for Ankara is: %f \n',max_Ank);
fprintf('The monthly max temperature for Istanbul is: %f \n',max_Ist);

%create array of 1s and 0s for condition temperature above average and find
%the sum of all the 1s to count the days.
fprintf('For %d days the max temperature was above average in Ankara.\n',sum(t_Ank>mean_Ank));
fprintf('For %d days the max temperature was above average in Istanbul.\n',sum(t_Ist>mean_Ist));

%max temperature of Ankara < max temperature of Istanbul vector
t_AnkLTht_Ist = [];
%max temperature of Ankara > max temperature of Istanbul vector
t_AnkGTt_Ist=[];
%max temperature of Ankara = max temperature of Istanbul vector
t_AnkEQt_Ist =[];

%loop expects size of t_Ist & t_Ank to be same
if(size(t_Ank)==size(t_Ist))
for i=1:length(t_Ank)
if(t_Ank(i) < t_Ist(i))
t_AnkLTht_Ist = [t_AnkLTht_Ist i];
elseif (t_Ank(i) > t_Ist(i))
t_AnkGTt_Ist = [t_AnkGTt_Ist i];
else
t_AnkEQt_Ist = [t_AnkEQt_Ist i];
end
end
fprintf('On the following %d days of the month,\n',length(t_AnkLTht_Ist));
fprintf('Ankara had lower max temperatures than Instanbul:\n');
disp(t_AnkLTht_Ist)
  
fprintf('On the following %d days of the month,\n',length(t_AnkGTt_Ist));
fprintf('Instabul had lower max temperatures than Ankara:\n');
disp(t_AnkGTt_Ist)
  
fprintf('On the following %d days of the month,\n',length(t_AnkEQt_Ist));
fprintf('Max temperatures were the same in both cities:\n');
disp(t_AnkEQt_Ist)
end

___________________________________________________________________________________________

Output:

>> test The monthly max temperature for Ankara is: 35.000000 The monthly max temperature for Istanbul is: 36.000000 For 15 da

Before running the code you have to perform the steps provided in the question to load the data from HW06citytemp.data. Or you can uncomment the variables I have defined.

Give thumbs for the solution if you found it helpful.

Add a comment
Know the answer?
Add Answer to:
Arrays: City temperatures The maximum daily temperatures (in "C) for Istanbul and Ankara during August 2019...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Maximum daily temperatures (in degrees Celsius) for 10 consecutive days in August, 2014 in London, Ontario...

    Maximum daily temperatures (in degrees Celsius) for 10 consecutive days in August, 2014 in London, Ontario are recorded below: 24, 23, 25, 26, 30, 28, 29, 34, 32, 35 What is the third quartile of these data? A. 30 B. 31 C. 32 D. 33 E. 34

  • Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays...

    Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...

  • The following timeplot shows daily high temperature in Winnipeg for 10 days. 30 31 32 33...

    The following timeplot shows daily high temperature in Winnipeg for 10 days. 30 31 32 33 Average high 27 28 29 o 2 8 10 Date What is the first quartile of temperature values during the given period? 0 27 28 A 28 2 ! o 27 2 4 6 8 10 Date What is the first quartile of temperature values during the given period? 27 28 30 33 32

  • I picke The weights (in pounds) of 30 preschool children are listed below. Find the five-number...

    I picke The weights (in pounds) of 30 preschool children are listed below. Find the five-number summary. 25 25 26 26.5 27 27 27.5 28 28 28.5 29 29 30 30 30.5 31 31 32 32.5 32.5 33 33 34 34.5 35 35 37 37 38 38 O A. Min = 25, Q1 = 27.5, Q2 = 30.5, Q3 = 33.5, Max = 38 O B. Min = 25, Q, = 28, Q2 = 30.5, Q3 = 34, Max =...

  • 1. The service departments at Tionesta Ford Lincoln Mercury and Sheffield Motors Inc., two of the...

    1. The service departments at Tionesta Ford Lincoln Mercury and Sheffield Motors Inc., two of the four Applewood Auto Group dealerships, were both open 24 working days last month. Listed below is the number of vehicles serviced last month at the two dealerships. Construct dot plots and report summary statistics to compare the two dealerships. Tionesta Ford Lincoln Mercury Friday Saturday Thursday Wednesday Tuesday Monday 26 28 39 27 33 23 35 32 33 28 32 30 32 27 31...

  • (use filename system: lastname_tempdata_firstinitial.m) 1. Gilat Chapter 6 Chapter7 #6. Use a single M-file and use...

    (use filename system: lastname_tempdata_firstinitial.m) 1. Gilat Chapter 6 Chapter7 #6. Use a single M-file and use mnemonic variable names of 3 characters or more for the variables to complete the problem. This is a comparison problem. If, selection, statements are not required but may be used. Loops are not required but may be used. Do not add any user defined M-files for this problem. Use fprintf statements to show the answer to each scenario: a), b), c), d), e) Investigate...

  • These are my instructions: Your data should have been read in from the data file and stored into ...

    These are my instructions: Your data should have been read in from the data file and stored into an array. Next you need to calculate the following and display in a single Message box: Average score Highest score Lowest score Mode of the scores Your program should be written using methods and should be well documented internally and externally. Your output should be displayed using Message boxes. This is the .text file to use with the instructions: 20 21 22...

  • 1. Write a C++ program that reads daily weather observation data from a file and writes...

    1. Write a C++ program that reads daily weather observation data from a file and writes monthly and annual summaries of the daily data to a file. a. The daily weather data will be contained in a file named wx_data.txt, with each line of the file representing the weather data for a single day. b. For each day, the date, precipitation amount, maximum temperature, and minimum temperature will be provided as tab-separated data with the following format: 20180101 0.02 37...

  • To study the effect of temperature on yield in a chemical process, five batches were produced...

    To study the effect of temperature on yield in a chemical process, five batches were produced at each of three temperature levels. The results follow. Temperature 50°C 60°C 70°C 35 32 27 25 33 32 37 36 32 40 25 34 33 29 35 a. Construct an analysis of variance table (to 2 decimals, if necessary). Round p-value to four decimal places. Source of Variation Sum of Squares Degrees of Freedom Mean Square F p-value Treatments 30 Error Total b....

  • In C++ Make a program that takes a positive integer 'n' and write an n x...

    In C++ Make a program that takes a positive integer 'n' and write an n x n matrix whose entries are listed as snail Example: (See picture) for n=6 Ej. Para n-6 2 2 2 20 21 22 23 24 7 19 32 33 34 258 18 31 36 35 26 9 17 30 29 28 27 10 16 15 14 13 12 11

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT