I have a dataframe with time in 10 min intervals.
date time h150 h200 h250 h500 h750 h1000 h1250 h1500
1 2018-06-01 07:40:00 7.2 8.0 7.8 7.9 7.8 7.8 7.9 7.9
2 2018-06-01 07:50:00 7.3 8.3 8.1 8.3 8.1 8.2 8.3 8.1
3 2018-06-01 08:00:00 7.5 9.0 8.3 8.4 8.2 8.2 8.5 8.3
4 2018-06-01 08:10:00 7.4 7.5 6.7 6.3 6.1 6.0 6.0 7.2
5 2018-06-01 08:20:00 7.4 5.9 5.7 5.6 5.4 5.4 5.3 5.3
6 2018-06-01 08:30:00 7.5 5.7 5.7 5.6 5.5 5.4 5.3 5.3
7 2018-06-01 08:40:00 7.5 5.7 5.7 5.6 5.5 5.4 5.3 5.3
8 2018-06-01 08:50:00 7.5 5.6 5.7 5.6 5.6 5.5 5.3 5.3
9 2018-06-01 09:00:00 7.4 5.6 5.7 5.6 5.6 5.5 5.3 5.3
10 2018-06-01 09:10:00 7.4 5.6 5.6 5.6 5.6 5.4 5.3 5.3
11 2018-06-01 09:20:00 7.4 5.6 5.6 5.6 5.5 5.5 5.4 5.3
12 2018-06-01 09:30:00 7.4 5.6 5.6 5.6 5.5 5.5 5.4 5.3
I only want to keep rows with full hours (i.e. 15:00:00).
How can I do this?
Thanks!
Perhaps this helps
library(dplyr)
library(stringr)
df1 %>%
filter(str_detect(time, ":00:00$"))
Related
Truck location coordinates>
X[Now] Y[Now]
A 5.4 15.4
B 8.3 9.0
C 6.6 5.2
D 6.5 13.5
E 15.0 1.9
Load location coordinates> print(Bcd)
Pick-up-X Pick-up-Y Drop-off-X Drop-off-Y
1 18.3 0.5 4.0 13.9
2 11.1 0.1 17.1 18.9
3 20.0 8.9 18.4 7.4
4 4.4 18.2 8.6 15.0
5 12.7 2.9 4.0 0.7
6 5.2 10.7 16.9 18.9
7 18.5 19.0 4.8 9.5
8 8.2 17.3 0.6 4.6
9 11.5 0.5 3.4 11.4
10 2.1 11.3 11.4 0.1
To animate stroke-dashoffset I am aware of using CSS #keyframes to move the stroke-dashoffset of a SVG path. However, because I want to size the SVG with background-size: cover, I am unable to target the individual elements inside the SVG since it's being referenced as a background-image in CSS.
Is there a way to use SVG's built-in <animate /> tags to animate stroke-dashoffset?
Lion head animation example
Animation of drawing lines from zero to maximum value is implemented by changing the stroke-dashoffset from maximum to zero.
attributeName="stroke-dashoffset"
begin="0.1s;f1.end+0.4s"
values="2037;0;2037"
dur="15s"
calcMode="linear"
/>
A second animation has been added - filling with a color that starts after the animation of drawing lines is completed.
<animate id="f1"
attributeName="fill"
begin="p1.end+0.4s"
dur="10s"
values="#FCFCFC;#A9A9A9;black;#A9A9A9;#FCFCFC"
/>
Drawing and erasing lines is accomplished using the attribute:
values="2037;0;2037"
.txt {
font-size:1.2em;
color:gray;
}
h1 {
text-align: center;
}
.lion {
padding:0.25em;
margin-left:-1.5em;
float:left;
}
<body>
<h1>Lion</h1>
<div class="lion">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="200" height="200" viewBox="-30 85 600 600"
style="border:0px dotted red;">
<title>The animation is drawing lines</title>
<g transform="scale(0.85) ">
<path class="path" fill="none" stroke-width="2" stroke ="black" stroke-dasharray= "2000" stroke-dashoffset="2000" d="m272.2 113.6c-0.3 0-0.6 0-0.9 0.1-0.7 0.1 2.2 2.5 10.9 11.2 9.8 9.7 18.2 19.1 23 25.5 5.9 8.1 12.3 18.6 16.4 29.1 0.8 1.6 3.6 11.9 4.6 16.9 0.5 2.8 1 5.4 1.2 5.8 0.8 2.5 3.9-8.4 4.8-13 1.2-5.6 1.2-11.4 1-17.1-0.2-5.8-0.5-11.8-2.2-17.4-1.4-4.8-3.6-9.4-6.7-13.3-6.6-8.2-15.1-15.1-24.4-20.1-6.4-3.5-13.8-4.9-20.9-6.5-2.2-0.5-4.8-1.3-6.9-1.2zm194.7 0c-2.1 0-4.7 0.7-6.9 1.2-7.1 1.6-14.5 3.1-20.9 6.5-9.3 5-17.8 11.8-24.4 20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1 0.2 15.1 0.5 22.7 0.3 8 0.9 16.1 1.4 24.1 0.6 8.7 1.2 17.3 2.2 26 0.8 7.4 1.4 14.8 3.1 22 1.5 6.7 3.8 13.2 6.3 19.6 1.2 3.1 3.3 8.3 4.3 9.1 1-0.9 3.1-6 4.3-9.1 2.5-6.4 4.8-12.9 6.3-19.6 1.7-7.2 2.3-14.6 3.1-22 1-8.6 1.5-17.3 2.2-26 0.6-8 1.1-16.1 1.4-24.1 0.3-7.6 1.2-21.7 0.5-22.7-0.5-0.8-1.4-0.8-15.2-0.9-1.3 0.1-2 0.1-2.6 0.1-0.7 0-1.3 0-2.6-0.1z">
<animate id="p1"
attributeName="stroke-dashoffset"
begin="0.1s;f1.end+0.4s"
values="2037;0;2037"
dur="15s"
calcMode="linear"
/>
<animate id="f1"
attributeName="fill"
begin="p1.end+0.4s"
dur="10s"
values="#FCFCFC;#A9A9A9;black;#A9A9A9;#FCFCFC"
/>
</path>
</g>
</svg>
</div>
<div class="txt">
<p> The lion (Panthera leo) is a species in the family Felidae; it is a muscular, deep-chested cat with a short, rounded head, a reduced neck and round ears, and a hairy tuft at the end of its tail. The lion is sexually dimorphic; males are larger than females with a typical weight range of 150 to 250 kg (330 to 550 lb) for males and 120 to 182 kg (265 to 400 lb) for females. Male lions have a prominent mane, which is the most recognisable feature of the species. A lion pride consists of a few adult males, related females and cubs. Groups of female lions typically hunt together, preying mostly on large ungulates. The species is an apex and keystone predator, although they scavenge when opportunities occur. Some lions have been known to hunt humans, although the species typically does not.</p>
<p>Typically, the lion inhabits grasslands and savannas but is absent in dense forests. It is usually more diurnal than other big cats, but when persecuted it adapts to being active at night and at twilight. In the Pleistocene, the lion ranged throughout Eurasia, Africa and North America but today it has been reduced to fragmented populations in Sub-Saharan Africa and one critically endangered population in western India. It has been listed as Vulnerable on the IUCN Red List since 1996 because populations in African countries have declined by about 43% since the early 1990s. Lion populations are untenable outside designated protected areas. Although the cause of the decline is not fully understood, habitat loss and conflicts with humans are the greatest causes for concern.</p>
<p>One of the most widely recognised animal symbols in human culture, the lion has been extensively depicted in sculptures and paintings, on national flags, and in contemporary films and literature. Lions have been kept in menageries since the time of the Roman Empire and have been a key species sought for exhibition in zoological gardens across the world since the late 18th century. Cultural depictions of lions were prominent in the Upper Paleolithic period; carvings and paintings from the Lascaux and Chauvet Caves in France have been dated to 17,000 years ago, and depictions have occurred in virtually all ancient and medieval cultures that coincided with the lion's former and current ranges.is not fully understood, habitat loss and conflicts with humans are the greatest causes for concern. </p>
wikipedia.org
</div>
</body>
I found the answer. You insert the <animate /> tag within the path.
<path stroke-dashoffset="200" stroke-dasharray="200 30" stroke-width="2" stroke="#333" d="...">
<animate attributeName="stroke-dashoffset" values="0 2000" dur="5s" repeatCount="indefinite" />
</path>
I was expecting points but got this when I did
plot(data$v3,data$v2)
my data
V2 V3
2 -2.0 2.7
3 0.5 3.9
4 1.3 4.5
5 5.7 6.0
6 10.4 8.7
7 3.4 2.7
8 7.6 3.2
9 4.1 5.6
10 5.0 9.2
11 8.5 11.7
12 12.3 6.8
13 16.1 13.0
14 13.2 11.9
15 8.8 8.6
16 7.9 6.1
17 1.1 4.9
18 3.0 1.0
19 4.5 7.2
20 2.7 2.7
21 7.6 7.6
I tried searching but from my understanding the function is supposed to give points, not bars. How do I fix this?
I am very new to R and I am currently playing around with it, I've run into an issue with plotting the following dataframe that I imported from a CSV.
studentname dateofbirth GSF3A3U FJÖ1UF05AU EÐLI2GR05BT FOR3D3U FOR3L3DU FOR4A3U ROB2B3U STÆR3FV05ET USA1012 WIN3B3DU userid
1 Ada Gauidóttir 13.8.1997 8.3 8.0 4.0 6.8 8.5 8.1 4.0 5.9 9.0 9.4 1
2 Gjaflaug Amildóttir 14.6.1998 6.0 6.6 6.2 8.9 4.7 9.4 8.5 8.1 4.3 5.3 2
3 Unndís Jónasdóttir 2.11.1998 8.7 7.8 6.9 10.0 7.0 10.0 9.3 5.4 7.2 5.8 3
4 Sigjón Elfráðurson 14.10.1996 9.3 8.9 6.2 8.1 9.7 5.5 6.8 9.0 6.9 4.2 4
5 Þórbjörg Rökkvidóttir 12.10.2000 4.9 6.9 5.2 6.9 5.3 5.5 5.6 4.8 8.9 9.2 5
6 Richard Hlérson 3.2.2000 9.4 7.7 8.4 6.1 6.4 9.6 4.9 7.2 9.3 7.0 6
7 Tala Arnalddóttir 18.8.1997 7.9 7.1 6.9 6.0 9.3 5.4 8.1 6.8 5.8 6.7 7
8 Petrína Estefandóttir 24.9.1994 9.6 4.9 5.0 8.4 7.9 8.7 5.5 10.0 4.0 9.5 8
9 Tanja Finnlaugurdóttir 11.7.1993 6.7 6.5 6.9 8.3 6.3 9.6 9.1 4.2 9.6 4.7 9
10 Elly Amosdóttir 6.7.2001 4.8 7.0 4.3 9.5 7.1 4.2 6.6 5.3 9.0 4.4 10
I am trying to plot this data so that the course names are on the X-axis and the rows for each course(the grades) are displayed on the Y-axis.
If I use the code below:
students[,3:12, drop=FALSE]
This result below is exactly what I'm looking for, but how do I scatterplot this?
GSF3A3U FJÖ1UF05AU EÐLI2GR05BT FOR3D3U FOR3L3DU FOR4A3U ROB2B3U STÆR3FV05ET USA1012 WIN3B3DU
1 8.3 8.0 4.0 6.8 8.5 8.1 4.0 5.9 9.0 9.4
2 6.0 6.6 6.2 8.9 4.7 9.4 8.5 8.1 4.3 5.3
3 8.7 7.8 6.9 10.0 7.0 10.0 9.3 5.4 7.2 5.8
4 9.3 8.9 6.2 8.1 9.7 5.5 6.8 9.0 6.9 4.2
5 4.9 6.9 5.2 6.9 5.3 5.5 5.6 4.8 8.9 9.2
6 9.4 7.7 8.4 6.1 6.4 9.6 4.9 7.2 9.3 7.0
7 7.9 7.1 6.9 6.0 9.3 5.4 8.1 6.8 5.8 6.7
8 9.6 4.9 5.0 8.4 7.9 8.7 5.5 10.0 4.0 9.5
9 6.7 6.5 6.9 8.3 6.3 9.6 9.1 4.2 9.6 4.7
10 4.8 7.0 4.3 9.5 7.1 4.2 6.6 5.3 9.0 4.4
I have the following data:
CET <- url("http://www.metoffice.gov.uk/hadobs/hadcet/cetml1659on.dat")
cet <- read.table(CET, sep = "", skip = 6, header = TRUE,
fill = TRUE, na.string = c(-99.99, -99.9))
names(cet) <- c(month.abb, "Annual")
cet <- cet[-nrow(cet), ]
rn <- as.numeric(rownames(cet))
Years <- rn[1]:rn[length(rn)]
annCET <- data.frame(Temperature = cet[, ncol(cet)],Year = Years)
cet <- cet[, -ncol(cet)]
cet <- stack(cet)[,2:1]
names(cet) <- c("Month","Temperature")
cet <- transform(cet, Year = (Year <- rep(Years, times = 12)),
nMonth = rep(1:12, each = length(Years)),
Date = as.Date(paste(Year, Month, "15", sep = "-"),format = "%Y-%b-%d"))
cet <- cet[with(cet, order(Date)), ]
idx <- cet$Year > 1900
cet <- cet[idx,]
cet <- cet[,c('Date','Temperature')]
plot(cet, type = 'l')
This demonstrates the monthly temperature cycle from 1900 to 2014 in England, UK.
I would like to evaluate the phase and amplitude of the seasonal cycle of temperature follwowing the methods outlined in this paper. Specifically, they describe that given 12 monthly values (as we have here) we can estimate the yearly component as:
where X(t) represents 12 monthly values of surface temperature, x(t+t0), t = 0.5,...,11.5, are 12 monthly values of the de-meaned monthly temperature, where the factor of two is to account for both positive and negative frequencies.
Then the amplitude and phase of the seasonal cycle can be calculated as
and
They specify, that each year of data, they calculate the yearly (one cycle per year) sinusoidal component using the Fourier transform, as the equation shown above.
I'm a bit stuck on how to generate the time series they demonstrate here. Can anyone please provide some guidance as to how I can reproduce these methods. Note, I also work in matlab - in case anyone has some suggestions as to how this would be achieved in that environment.
Here is a subset of the data.
Date Temperature
1980-01-15 2.3
1980-02-15 5.7
1980-03-15 4.7
1980-04-15 8.8
1980-05-15 11.2
1980-06-15 13.8
1980-07-15 14.7
1980-08-15 15.9
1980-09-15 14.7
1980-10-15 9
1980-11-15 6.6
1980-12-15 5.6
1981-01-15 4.9
1981-02-15 3
1981-03-15 7.9
1981-04-15 7.8
1981-05-15 11.2
1981-06-15 13.2
1981-07-15 15.5
1981-08-15 16.2
1981-09-15 14.5
1981-10-15 8.6
1981-11-15 7.8
1981-12-15 0.3
1982-01-15 2.6
1982-02-15 4.8
1982-03-15 6.1
1982-04-15 8.6
1982-05-15 11.6
1982-06-15 15.5
1982-07-15 16.5
1982-08-15 15.7
1982-09-15 14.2
1982-10-15 10.1
1982-11-15 8
1982-12-15 4.4
1983-01-15 6.7
1983-02-15 1.7
1983-03-15 6.4
1983-04-15 6.8
1983-05-15 10.3
1983-06-15 14.4
1983-07-15 19.5
1983-08-15 17.3
1983-09-15 13.7
1983-10-15 10.5
1983-11-15 7.5
1983-12-15 5.6
1984-01-15 3.8
1984-02-15 3.3
1984-03-15 4.7
1984-04-15 8.1
1984-05-15 9.9
1984-06-15 14.5
1984-07-15 16.9
1984-08-15 17.6
1984-09-15 13.7
1984-10-15 11.1
1984-11-15 8
1984-12-15 5.2
1985-01-15 0.8
1985-02-15 2.1
1985-03-15 4.7
1985-04-15 8.3
1985-05-15 10.9
1985-06-15 12.7
1985-07-15 16.2
1985-08-15 14.6
1985-09-15 14.6
1985-10-15 11
1985-11-15 4.1
1985-12-15 6.3
1986-01-15 3.5
1986-02-15 -1.1
1986-03-15 4.9
1986-04-15 5.8
1986-05-15 11.1
1986-06-15 14.8
1986-07-15 15.9
1986-08-15 13.7
1986-09-15 11.3
1986-10-15 11
1986-11-15 7.8
1986-12-15 6.2
1987-01-15 0.8
1987-02-15 3.6
1987-03-15 4.1
1987-04-15 10.3
1987-05-15 10.1
1987-06-15 12.8
1987-07-15 15.9
1987-08-15 15.6
1987-09-15 13.6
1987-10-15 9.7
1987-11-15 6.5
1987-12-15 5.6
1988-01-15 5.3
1988-02-15 4.9
1988-03-15 6.4
1988-04-15 8.2
1988-05-15 11.9
1988-06-15 14.4
1988-07-15 14.7
1988-08-15 15.2
1988-09-15 13.2
1988-10-15 10.4
1988-11-15 5.2
1988-12-15 7.5
1989-01-15 6.1
1989-02-15 5.9
1989-03-15 7.5
1989-04-15 6.6
1989-05-15 13
1989-06-15 14.6
1989-07-15 18.2
1989-08-15 16.6
1989-09-15 14.7
1989-10-15 11.7
1989-11-15 6.2
1989-12-15 4.9
1990-01-15 6.5
1990-02-15 7.3
1990-03-15 8.3
1990-04-15 8
1990-05-15 12.6
1990-06-15 13.6
1990-07-15 16.9
1990-08-15 18
1990-09-15 13.2
1990-10-15 11.9
1990-11-15 6.9
1990-12-15 4.3
1991-01-15 3.3
1991-02-15 1.5
1991-03-15 7.9
1991-04-15 7.9
1991-05-15 10.8
1991-06-15 12.1
1991-07-15 17.3
1991-08-15 17.1
1991-09-15 14.7
1991-10-15 10.2
1991-11-15 6.8
1991-12-15 4.7
1992-01-15 3.7
1992-02-15 5.4
1992-03-15 7.5
1992-04-15 8.7
1992-05-15 13.6
1992-06-15 15.7
1992-07-15 16.2
1992-08-15 15.3
1992-09-15 13.4
1992-10-15 7.8
1992-11-15 7.4
1992-12-15 3.6
1993-01-15 5.9
1993-02-15 4.6
1993-03-15 6.7
1993-04-15 9.5
1993-05-15 11.4
1993-06-15 15
1993-07-15 15.2
1993-08-15 14.6
1993-09-15 12.4
1993-10-15 8.5
1993-11-15 4.6
1993-12-15 5.5
1994-01-15 5.3
1994-02-15 3.2
1994-03-15 7.7
1994-04-15 8.1
1994-05-15 10.7
1994-06-15 14.5
1994-07-15 18
1994-08-15 16
1994-09-15 12.7
1994-10-15 10.2
1994-11-15 10.1
1994-12-15 6.4
1995-01-15 4.8
1995-02-15 6.5
1995-03-15 5.6
1995-04-15 9.1
1995-05-15 11.6
1995-06-15 14.3
1995-07-15 18.6
1995-08-15 19.2
1995-09-15 13.7
1995-10-15 12.9
1995-11-15 7.7
1995-12-15 2.3
1996-01-15 4.3
1996-02-15 2.5
1996-03-15 4.5
1996-04-15 8.5
1996-05-15 9.1
1996-06-15 14.4
1996-07-15 16.5
1996-08-15 16.5
1996-09-15 13.6
1996-10-15 11.7
1996-11-15 5.9
1996-12-15 2.9
1997-01-15 2.5
1997-02-15 6.7
1997-03-15 8.4
1997-04-15 9
1997-05-15 11.5
1997-06-15 14.1
1997-07-15 16.7
1997-08-15 18.9
1997-09-15 14.2
1997-10-15 10.2
1997-11-15 8.4
1997-12-15 5.8
1998-01-15 5.2
1998-02-15 7.3
1998-03-15 7.9
1998-04-15 7.7
1998-05-15 13.1
1998-06-15 14.2
1998-07-15 15.5
1998-08-15 15.9
1998-09-15 14.9
1998-10-15 10.6
1998-11-15 6.2
1998-12-15 5.5
1999-01-15 5.5
1999-02-15 5.3
1999-03-15 7.4
1999-04-15 9.4
1999-05-15 12.9
1999-06-15 13.9
1999-07-15 17.7
1999-08-15 16.1
1999-09-15 15.6
1999-10-15 10.7
1999-11-15 7.9
1999-12-15 5
2000-01-15 4.9
2000-02-15 6.3
2000-03-15 7.6
2000-04-15 7.8
2000-05-15 12.1
2000-06-15 15.1
2000-07-15 15.5
2000-08-15 16.6
2000-09-15 14.7
2000-10-15 10.3
2000-11-15 7
2000-12-15 5.8
2001-01-15 3.2
2001-02-15 4.4
2001-03-15 5.2
2001-04-15 7.7
2001-05-15 12.6
2001-06-15 14.3
2001-07-15 17.2
2001-08-15 16.8
2001-09-15 13.4
2001-10-15 13.3
2001-11-15 7.5
2001-12-15 3.6
2002-01-15 5.5
2002-02-15 7
2002-03-15 7.6
2002-04-15 9.3
2002-05-15 11.8
2002-06-15 14.4
2002-07-15 16
2002-08-15 17
2002-09-15 14.4
2002-10-15 10.1
2002-11-15 8.5
2002-12-15 5.7
2003-01-15 4.5
2003-02-15 3.9
2003-03-15 7.5
2003-04-15 9.6
2003-05-15 12.1
2003-06-15 16.1
2003-07-15 17.6
2003-08-15 18.3
2003-09-15 14.3
2003-10-15 9.2
2003-11-15 8.1
2003-12-15 4.8
2004-01-15 5.2
2004-02-15 5.4
2004-03-15 6.5
2004-04-15 9.4
2004-05-15 12.1
2004-06-15 15.3
2004-07-15 15.8
2004-08-15 17.6
2004-09-15 14.9
2004-10-15 10.5
2004-11-15 7.7
2004-12-15 5.4
2005-01-15 6
2005-02-15 4.3
2005-03-15 7.2
2005-04-15 8.9
2005-05-15 11.4
2005-06-15 15.5
2005-07-15 16.9
2005-08-15 16.2
2005-09-15 15.2
2005-10-15 13.1
2005-11-15 6.2
2005-12-15 4.4
2006-01-15 4.3
2006-02-15 3.7
2006-03-15 4.9
2006-04-15 8.6
2006-05-15 12.3
2006-06-15 15.9
2006-07-15 19.7
2006-08-15 16.1
2006-09-15 16.8
2006-10-15 13
2006-11-15 8.1
2006-12-15 6.5
2007-01-15 7
2007-02-15 5.8
2007-03-15 7.2
2007-04-15 11.2
2007-05-15 11.9
2007-06-15 15.1
2007-07-15 15.2
2007-08-15 15.4
2007-09-15 13.8
2007-10-15 10.9
2007-11-15 7.3
2007-12-15 4.9
2008-01-15 6.6
2008-02-15 5.4
2008-03-15 6.1
2008-04-15 7.9
2008-05-15 13.4
2008-06-15 13.9
2008-07-15 16.2
2008-08-15 16.2
2008-09-15 13.5
2008-10-15 9.7
2008-11-15 7
2008-12-15 3.5
2009-01-15 3
2009-02-15 4.1
2009-03-15 7
2009-04-15 10
2009-05-15 12.1
2009-06-15 14.8
2009-07-15 16.1
2009-08-15 16.6
2009-09-15 14.2
2009-10-15 11.6
2009-11-15 8.7
2009-12-15 3.1
2010-01-15 1.4
2010-02-15 2.8
2010-03-15 6.1
2010-04-15 8.8
2010-05-15 10.7
2010-06-15 15.2
2010-07-15 17.1
2010-08-15 15.3
2010-09-15 13.8
2010-10-15 10.3
2010-11-15 5.2
2010-12-15 -0.7
2011-01-15 3.7
2011-02-15 6.4
2011-03-15 6.7
2011-04-15 11.8
2011-05-15 12.2
2011-06-15 13.8
2011-07-15 15.2
2011-08-15 15.4
2011-09-15 15.1
2011-10-15 12.6
2011-11-15 9.6
2011-12-15 6
2012-01-15 5.4
2012-02-15 3.8
2012-03-15 8.3
2012-04-15 7.2
2012-05-15 11.7
2012-06-15 13.5
2012-07-15 15.5
2012-08-15 16.6
2012-09-15 13
2012-10-15 9.7
2012-11-15 6.8
2012-12-15 4.8
2013-01-15 3.5
2013-02-15 3.2
2013-03-15 2.7
2013-04-15 7.5
2013-05-15 10.4
2013-06-15 13.6
2013-07-15 18.3
2013-08-15 16.9
2013-09-15 13.7
2013-10-15 12.5
2013-11-15 6.2
2013-12-15 6.3
2014-01-15 5.7
2014-02-15 6.2
2014-03-15 7.6
2014-04-15 10.2
2014-05-15 12.2
2014-06-15 15.1
2014-07-15 17.7
2014-08-15 14.9
2014-09-15 15.1
2014-10-15 12.5
2014-11-15 8.6
2014-12-15 5.2
Literally, the formula for Y can be represented in MATLAB as:
t=0.5:0.5:11.5; %//make sure the step size is indeed 0.5
Y = 1/6.*sum(exp(2*pi*i.*t/12).*X(t0-t); %// add the function for X
phi = atan2(imag(Y)/real(Y)); %// seasonal phase
without knowing the function for X I can't be sure this can indeed be vectorised, or whether you'd have to loop, which can be done like:
t=0.5:0.5:11.5; %//make sure the step size is indeed 0.5
Ytmp(numel(t),1)=0; %// initialise output
for ii = 1:numel(t)
Ytmp(ii,1) = exp(2*pi*i.*t(ii)/12).*X(t0-t(ii));
end
Y = 1/6 * sum(Ytmp)
Just slot in any t0 you want, loop over the codes above and you have your time series.