# 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)
Run the code above in your browser using DataLab