coeffs: Calculate coefficients of a function's series expansion

Description Usage Arguments Value References Examples

View source: R/coeffs.R

Description

This function is used in InfKern to produce the kernel matrix from functional data defined on the interval [0,1]. For further details see Section 7.4 of \insertCiteBKS2020USP.

Usage

1
coeffs(X, Ntrunc)

Arguments

X

The discretised functions whose coefficients are required. This should be a matrix with one row per function, and with Ndisc columns, where Ndisc is the grid size of the discretisation.

Ntrunc

The number of coefficients that are required. The function returns coefficients 1,...,Ntrunc.

Value

The coefficients of X in its expansion in terms of sine functions. See \insertCiteBKS2020USP for more detail.

References

\insertRef

BKS2020USP

Examples

1
2
3
4
5
6
7
8
t=seq(from=0,to=1,length.out=1000); X=t^2
U=coeffs(X,100)[1,]; L=5
plot(t,X,type="l")
approx=rep(0,1000)
for(l in 1:L){
approx=approx+qnorm(U[l])*sqrt(2)*sin((l-1/2)*pi*t)/((l-1/2)*pi)
lines(t,approx,col=l+1)
}

USP documentation built on Jan. 27, 2021, 5:08 p.m.

Related to coeffs in USP...