# set up the fourier basis
nbasis <- 65
dayrange <- c(0,365)
daybasis <- create.fourier.basis(dayrange, nbasis)
# Make temperature fd object
# Temperature data are in 12 by 365 matrix tempav
# See analyses of weather data.
# Set up sampling points at mid days
daytime <- (1:365)-0.5
# Convert the data to a functional data object
tempfd <- data2fd(daily$tempav, daytime, daybasis)
# set up the harmonic acceleration operator
Lbasis <- create.constant.basis(dayrange);
Lcoef <- matrix(c(0,(2*pi/365)^2,0),1,3)
bfdobj <- fd(Lcoef,Lbasis)
bwtlist <- fd2list(bfdobj)
harmaccelLfd <- Lfd(3, bwtlist)
# evaluate the value of the harmonic acceleration
# operator at the sampling points
Ltempmat <- eval.fd(daytime, tempfd, harmaccelLfd)
# Plot the values of this operator
matplot(daytime, Ltempmat, type="l")Run the code above in your browser using DataLab