Description Usage Arguments Details Value See Also Examples
View source: R/Package_Sim.GenerateData.r
Generate an orthogonal Fourier basis system in the interval [0, 1]. The set of basis functions are used to be the eigenfunctions to generate the covariance matrix of a latent process.
1 |
t |
the set of values to be evaluated, taking values from [0, 1] |
degree |
the degree of Fourier basis functions, taking values as 0, 1, 2, …; See 'Details' |
normalized |
logical value; If TRUE (default) then the values are normalized such that the L2 norm of the function values is 1 |
The Fourier basis functions considered here are
{1, √{2}cos(2π t), √{2}sin(2π t), √{2}cos(4π t), √{2}sin(4π t), …},
which corresponding to degree
= 0, 1, 2, 3, 4 …. Typically the degree
is even.
A vector which are the evaluations of the Fourier basis function at t
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # time points
t <- seq(from = 0, to = 1, length = 100)
# basis matrix evaluated at the time points t
# an intercept column is included
Phi <- cbind(DFT.basis(t, degree = 0), DFT.basis(t, degree = 1),
DFT.basis(t, degree = 2))
# check the orthogonality
crossprod(Phi) # is equal to I_3 up to rounding errors
# plot the basis system
matplot(t, Phi, type = "l", lwd = 2, lty = 1:3,
ylab = "basis function", main = "Fourier Basis (normalized)")
legend("top", c("degree = 0", "degree = 1", "degree = 2"),
col = 1:3, lwd = 2, lty = 1:3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.