DFT.basis: Discrete Fourier Transformation (DFT) Basis System

Description Usage Arguments Details Value See Also Examples

View source: R/Package_Sim.GenerateData.r

Description

Generate an orthogonal Fourier basis system in the interval [0, 1]. The set of basis functions are used to be the eigenfunctions to generate the covariance matrix of a latent process.

Usage

1
DFT.basis(t, degree = 0, normalized = TRUE)

Arguments

t

the set of values to be evaluated, taking values from [0, 1]

degree

the degree of Fourier basis functions, taking values as 0, 1, 2, …; See 'Details'

normalized

logical value; If TRUE (default) then the values are normalized such that the L2 norm of the function values is 1

Details

The Fourier basis functions considered here are

{1, √{2}cos(2π t), √{2}sin(2π t), √{2}cos(4π t), √{2}sin(4π t), …},

which corresponding to degree = 0, 1, 2, 3, 4 . Typically the degree is even.

Value

A vector which are the evaluations of the Fourier basis function at t.

See Also

legendre.polynomials

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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)

Example output

Loading required package: sn
Loading required package: stats4

Attaching package: 'sn'

The following object is masked from 'package:stats':

    sd

              [,1]          [,2]         [,3]
[1,]  1.000000e+00 -7.124391e-17 1.407195e-02
[2,] -7.124391e-17  1.000000e+00 3.174720e-17
[3,]  1.407195e-02  3.174720e-17 1.000000e+00

cSFM documentation built on May 29, 2017, 6:10 p.m.

Related to DFT.basis in cSFM...