Library: | math |
See also: | Fouriertrans FDApca |
Quantlet: | Fouriereval | |
Description: | Evaluates the basis functions of fourier series based on the period and the grid points, where the functions are evaluated. |
Usage: | phi = Fouriereval(nbasis,nresol,period) | |
Input: | ||
nbasis | scalar, the number of basis functions | |
nresol | scalar, the number of points where the basis functions are evaluated | |
period | scalar, the period based on the grid points for original data | |
Output: | ||
phi | K x G matrix, the evaluated basis functions, where K is the number of basis functions and G the number of grid points for evaluation |
library("math") library("plot") K=31 ; number of basis functions in algorithm nresol=100 ; number of grid points period=365 ; period x = Fouriereval(K,nresol,period) grid = 2*pi *(1:100) / 100 line(grid ~(x[2,]'), grid ~(x[3,]'))
Produces basis functions evaluated by using Fourier series. Plot shows the second and third basis function.