generate_basis {SpatFD} | R Documentation |
Creates functional ortogonal basis as fd object.
Description
This function returns the first nth elements of a functional basis as an fd object.
Usage
generate_basis(basis = "Fourier",n_functions = 10,L = NULL,fda_basis = NULL)
Arguments
basis |
Name of the functional basis. Currently only |
n_functions |
Positive integer giving the number of functions that are going to be generated. |
L |
For |
fda_basis |
|
Details
Fourier basis functions are given by:
f_k(x) = \sqrt{\frac{2}{L}}\text{sin}\left(\frac{k\pi x}{2L}\right)
for k=2,4,6,...
, and
f_k(x) = \sqrt{\frac{2}{L}}\text{cos}\left(\frac{(k + 1)\pi x}{2L}\right)
for k=1,3,5,...
.
Furthermore, Legendre basis functions are given by:
f_k(x) = \frac{1}{2^nn!}\frac{d^n}{dx}(x^2 - 1)^n
for k = 1,2,3,4,...
.
Value
fda::fd
object with n_functions
curves.
Note
Generating n
Legendre basis functions requires to evaluate \frac{n(n+1)}{2}
derivates, so its recomended to use values below 10.
Author(s)
Samuel Sánchez Gutiérrez ssanchezgu@unal.edu.co.
References
Conway, J. B. (2019). A course in functional analysis (Vol. 96). Springer.
See Also
Examples
library(fda)
# 10 Fourier functions
res <- generate_basis(L=1)
plot(res)
# 20 Fourier functions
res <- generate_basis(n_functions = 20,L = 3)
plot(res)
# 10 Legendre functions
res <- generate_basis(basis = "Legendre")
plot(res)
# 7 Legendre functions
res <- generate_basis(basis = "Legendre", n_functions = 7)
plot(res)