Question
A given file called avgtemp_data.txt stores on every line a year (starting with 2000) followed by the average temperature in Wichita, KS for each month
A given file called avgtemp_data.txt stores on every line a year (starting with 2000) followed by the average temperature in Wichita, KS for each month of that year.
For example, the first two lines of the file look like:
00 33.8 42.0 48.5 55.1 68.9 73.1 80.3 86.6 74.4 61.6 40.1 23.9
01 32.3 33.5 42.8 60.2 67.5 75.3 86.3 82.7 70.0 59.1 50.9 39.0
As can be seen, only two digits were used for the year. Write a program that will: a. read this file into a matrix and stores the years correctly as 20xx, where xx is the year number from the file. b. store each of the columns into separate 1 x 13 arrays that contain the year followed by the average temperatures for each month in that year. c. calculate the overall average temperature for each year, determine the year with the minimum overall average temperature, and displays the result in the command window. Use built-in MATLAB functions to calculate the overall average temperature for each year and to find the location of the minimum overall average temperature.
avgtemp_data.txt 00 33.8 42.0 48.5 55.1 68.9 73.1 80.3 86.6 74.4 61.6 40.1 23.9 01 32.3 33.5 42.8 60.2 67.5 75.3 86.3 82.7 70.0 59.1 50.9 39.0 02 36.0 37.6 42.0 58.2 63.7 76.5 81.6 80.3 73.7 52.3 44.2 35.6 03 32.2 33.3 45.5 58.1 64.6 72.6 84.3 82.3 66.0 58.2 45.8 37.2 04 32.1 33.7 50.3 56.8 69.4 73.6 77.3 75.4 74.4 60.9 47.1 37.7 05 31.3 40.8 46.4 56.9 67.4 77.5 79.9 78.7 74.5 60.0 47.9 32.7 06 43.2 36.3 49.0 63.1 67.9 76.6 83.6 81.7 67.9 57.9 48.2 39.0 07 29.9 34.2 54.8 53.2 68.2 73.9 79.5 83.0 74.0 61.4 46.1 31.2 08 32.6 34.8 45.5 53.9 66.1 76.8 80.2 77.8 67.9 57.6 46.2 33.1 09 32.2 42.4 47.8 55.0 65.6 79.0 78.2 76.3 68.5 51.2 50.3 29.9 10 28.9 32.4 47.1 60.9 65.7 80.7 82.7 83.5 74.2 62.3 46.4 34.2 11 28.9 32.7 48.0 58.8 66.4 81.4 89.3 84.9 69.3 60.2 45.1 36.7 12 37.9 40.5 57.9 62.5 72.8 79.7 88.2 80.1 71.8 58.4 49.9 37.5 13 36.0 35.7 43.3 51.3 65.0 78.1 79.5 78.1 75.1 58.4 43.9 30.2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started