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 "Fourier" or "Legendre" are supported.

n_functions

Positive integer giving the number of functions that are going to be generated.

L

For "Fourier" basis, limits of the domain of the basis (-L,L). For "Legendre" basis, the domain is (-1,1).

fda_basis

basisfd object from package fda that will be used in the fd object that is returned. If NULL, default basis are generated.

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

sim_functional_process

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)


[Package SpatFD version 0.0.1 Index]