Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Australian Bureau of Meteorology (Abom ) collects meteorological data on a daily basis. Table1 and table 2 shows a typical example of the collected

The Australian Bureau of Meteorology (Abom ) collects meteorological data on

a daily basis. Table1 and table 2 shows a typical example of the collected data of the Toowoomba January 2013 & 2012 Data

The data collected by theAbom is usually stored in a text file where the

1st column is the day of month,

2nd column is minimum temperature (?C),

3rd column is maximum temperature (?C),

4th column is the rainfall (mm),

5th column is the 9 am temperature (?C), and

6th column is the 3 pm temperature (C).

Matlab can be used to analyse the data contained in these files. First the data

can be loaded intoMatlab using the Matlab command load. This gives an

array variable in Matlab containing the data.

Your task in this assignment, is to compare data from two months. To automate

the task you would need to have several specialiseMatlabfunctions. These

functions will also enable the user to analyse other months of data, if available.

Tasks

1.Write a function which uses theMatlab load command to load two

monthly data files. Use the following function definition line in

Matlab to start your function.

function [data1,data2]=loadbom(file1,file2)

wher file1 and file2 are strings containing the filenames; and

data1 and data2 are output variables containing the data arrays returned by

Matlab .

2-Write a second Matlab function that takes as its input one of the data array obtained via the load command (e.g. data1). e function should than calculate the average and standard deviation of the min., max., 9 am, 3 pm temperatures and rainfall for the month. is function should return these values to the user via the function call. Use the following function de nition as your starting point.

 function [tmin,tmax,t9,t3,rain] = averages(bomdata) 

where all the return values are 2 1 vectors. at is: row 1 of the return values contain the average, while row 2 contains the standard deviation.

3-Write another Matlab function that takes the same input as in Task 2, but this time calculates a vector containing the di erences in the daily min. and max. temperatures; and generates a plot showing how these di erences varied on a daily basis. It should return the vector of dif- ferences to the user, via the function call. Use the following function de nition as your starting point.

 function [diff] = differences(bomdata) 

4-The final Matlab function required takes two sets of Abom data and plots the rainfall from both sets on the same axis. e function should use the following function de nition.

 function compareplot(bomdata1, bomdata2) 

5-Finally, write a driverMatlab script that will run all the above functions for the January 2012 and 2013 Toowoomba data and output the results (that is, averages etc.) in a readable format.

Table1 - Toowoomba201301

1 16.7 26.7 0 21.4 26.2
2 16.6 33.7 0 25.5 33.5
3 18.2 29.3 0 22.9 28.2
4 16.7 28.2 0 21.6 27
5 16.9 26.6 0 22.4 25.7
6 17.7 25.6 0 21.6 24
7 17.3 27.8 0 20.8 25.8
8 17.6 30.8 0.2 21.4 29.3
9 17.3 34.4 0 25.9 33.5
10 20.6 34.2 1.8 26 32.9
11 17.9 32.2 65.8 24.7 31.4
12 20.9 34.4 0 26.4 33.3
13 21.1 35.1 0 26.5 33.7
14 23 28.9 0 26.9 25.5
15 16 25.3 0 19.1 24.1
16 16.5 28.3 0 21.6 27.9
17 16.6 30.1 0 22.7 29.5
18 17.3 33.7 0 23.7 28.9
19 19.5 35.1 0 25.8 32.9
20 19.8 30.2 2.6 22.4 29.2
21 18.5 26.9 0.6 19.9 25
22 18.4 28.5 1.2 21.1 27.3
23 18.8 30.2 0 23.3 29.3
24 18.7 21.9 0 20.3 20.6
25 18.5 22.2 16 19.9 21
26 19.5 21.5 43.8 20.9 20.7
27 19.4 21.4 142.8 19.7 19.5
28 19.4 26.2 141.2 21.4 22.6
29 19.4 27.5 33.6 22.1 23.7
30 19.5 29.3 0 21.8 26.6
31 19.5 28.5 0 21 26.1

Table 2 Toowoomba201201

1 14.7 24.8 0.4 19.6 23.9
2 14.1 25.4 0 19.8 24.3
3 15.1 25.4 0 20.4 24.7
4 15 29.4 0 20.3 28.2
5 16.9 26.6 0 21.7 26
6 15.7 29.5 0.2 22.3 28.4
7 17.8 26.5 0 21.1 25.4
8 17.9 31.2 0 21.6 30.7
9 20.9 34.9 0 27.5 33.2
10 19.4 33.6 0 27.6 33
11 18.7 31.3 0 26.2 29.9
12 16.4 30.3 0 22.7 28.8
13 15.4 27.2 0 20.2 25.7
14 15.7 23.8 0 19.1 22.7
15 15.4 22 3.6 16.1 19.1
16 15.2 23 4.4 17.6 21.6
17 15.6 22.1 4.6 17.9 21
18 15.3 28.2 7.4 21.9 27.2
19 18.1 29 1.6 22.4 28.1
20 17.2 27.9 0 22.2 23.1
21 16.7 27.2 0 21.6 26.1
22 16.6 26.9 0 22 23.9
23 17.6 24.6 0.6 19.8 23.2
24 17.9 20.1 9 18.5 19
25 17.7 23.9 26.8 19.1 21.5
26 18.9 28.6 2.2 23.8 27
27 19.6 20.7 1 20.3 20
28 17.4 20 25.6 18.7 18.2
29 16.7 22 9.4 17.7 19.6
30 17.5 25.6 1.2 20.1 24.8
31 19.8 25.6 0.2 22.5 24.6

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

Students also viewed these Databases questions