1
votes

This is a rather vague question but here we go - I would like to generate a time series for hourly measurements of one year, so for 2011 ti would 8760 values within the series. To make it easier to understand what I am trying to do I will use a real world example:

If we had a time series of hourly air temperature measurements an then plotted the entire series it would look similar to a bell shaped curve i.e.

    a = 0; b = 30;
    x = a + (b-a) * rand(1, 8760);
    m = (a + b)/2;
    s = 12; 
    p1 = -.5 * ((x - m)/s) .^ 2;
    p2 = (s * sqrt(2*pi));
    f = exp(p1) ./ p2;
    plot(x,f,'.')

with the maximum values occurring in mid summer and lowest values during the winter. However, by zooming in on specific days we would see that the temperature also fluctuates between the day and the evening where maximum temperatures would occur at approximately 15:00 and minimum temperature at approximately 06:00.

So, my question is how would I generate this series, i.e. a time series which had a maximum value of say 30 degrees in mid summer i.e. value (8760/2) and also had the daily pattern mentioned above incorporated into the overall pattern?

2

2 Answers

3
votes

The obvious way to do this would be to add together 2 sine waves, one for the diurnal variations and one for the annual variations.

Whether or not a sine wave is close enough to a bell-shaped curve for your liking I don't know, but I could make a vague argument that since the variation in annual and diurnal temperatures is (in part) a product of (approximately) circular motions you should be using sine waves anyway.

If you need help generating the sine waves update your question.

2
votes

If I understand the question correctly, you'd like to have a superposition of the two series of known shape, right? If so, you just have to add them up. The important part is to shift the daily temperature fluctuation signal so that its mean is 0, provided the "year" curve expresses the average temperature.