Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab questionuse matlab program to answer Weather data are important for many applications. Assume that you are working with an ASCII text data file that

Matlab questionuse matlab program to answer

Weather data are important for many applications. Assume that you are working with an ASCII text data file that was created some time ago to store temperature and precipitation data for every month in each year. The file contains a header as the first line (that describes the data) followed sequentially by one line for each month of each year, where the first element of each recorded line is the year, the second is the month, and the third through fifth elements, respectively, are the low temperature (F), high temperature (F), and precipitation depth (inches) for that month of that year. The elements are separated by one spaces. For example, a file with this format would look like the following:

Yr Mnth LowTemp(F) HighTemp(F) Precip(in) 89 Feb 53.8 71.6 2.67 89 Mar 58.5 76.3 2.84 89 Apr 62.4 80.6 1.80 89 May 68.9 86.3 2.85 : (continues with the same pattern) 

Problem 1. Write a program that reads data in this format and creates a new ASCII text file that is equivalent but has the year values converted to be four digit (e.g. 1989). The names of both files should be provided by the user. For example, after being processed by your program, the above data would start with the following lines.

Yr Mnth LowTemp(deg F) HighTemp(deg F) Precip(in) 1989 Feb 53.8 71.6 2.67 1989 Mar 58.5 76.3 2.84 1989 Apr 62.4 80.6 1.80 1989 May 68.9 86.3 2.85 : (continues with the same pattern) 

Problem 2. Write a program that will read in and plot data from the above two types of ASCII files. Specifically, it should generate a figure with two subplots, one that plots both high and low temperatures versus time, and one that plots the precipitation versus time. Be sure to label your figure well and use good practices. (For this problem, you do not need to use data type conversion for year/month. Just create a vector for the x-axis data that is the same size as the y-axis data being plotted, with values from 1 to the number of months.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago