Vous êtes sur la page 1sur 1

Function files and interpolation

1a. Load the file ppt.dat. Write a function code that calculates the mean monthly precipitation for
each year. Make sure that the function file will calculate the mean precipitation regardless of if
the input data is a vector or a matrix.
b. Add to the function file a calculation of the total yearly precipitation and the standard
deviation for each month. Plot the mean monthly precipitation and the standard deviation in
separate sub windows using subplot.
2. Load the data in the file met_2006.dat. This file contains meteorological data from the Tarfala
research station in the north of Sweden. As you might have guessed the data is from 2006. The
date is given in Julian days.
In the file youll find that some rows have more values than the others, the rows starting with the
value 101 are hourly data, the rows starting with 103 are a mean value for the last 3 hours and
the rows starting with 124 are daily data. You should load the data, since the data doesnt have
the same number of columns on each row youll have to use e.g. dlmread.
Write a function file that will extract the hourly and the daily data from the file. The file should
also calculate the total precipitation (mm/h) for each month, the precipitation is given in the
column 13. The function file shall return the hourly and daily temperature data (column 7) , the
wind direction (column 10), wind speed (column 9) and the monthly precipitation. The wind data
should be extracted from the hourly data and not from the daily data.
Thereafter an m-file that calls on the function file shall plot the hourly and daily temperature data
in the same graph. The total monthly precipitation shall be shown in an appropriate figure. Use
the command compass to plot the wind direction and the wind speed.
3. Using the data
Depth = [0 10.5 41.5 45.5 58.5 66.5 83.5 91.5 114.5 125 155.5 182 195.5];
Age = [0 1015 1480 1660 1665 2190 2745 3075 3470 4020 4335 6050 6585];
Using interpolation generate a dataset with one measurement every 0.5cm. Generate a 4th order
polynomial for those values. Find out the equation for the curve.
4. Load the data co2.data and co2_half_year.mat. They are measurements from the same area and
time and are showing the CO2 content in the air in Mauna Loa at Hawaii. Plot these two curves
in the same graph. Fit a curve to both these two datasets. For this you can use the toolbox cftool.
Discuss the two curves and the differences between them. Choose at least two different ways to
fit a curve. The x-axis is set to only correspond to the number of measurements not to any
specific datum.

Vous aimerez peut-être aussi