Learn R Programming

USP (version 0.1.2)

FourierBasis: Fourier basis functions

Description

Computes the values of the one-dimensional Fourier basis functions at a vector of locations \(x\) and with a vector of frequencies \(m\). The scaling factor of \(2\pi\) is included, so that the function returns, e.g., \(\sqrt{2} \cos(2\pi m x)\).

Usage

FourierBasis(a, m, x)

Arguments

a

Sine or cosine; \(a=0\) gives cosine and \(a=1\) gives sine.

m

Vector of frequencies \(m\).

x

Vector of locations \(x\).

Value

Returns the values of \(\sqrt{2} \cos(2\pi m x)\).

References

BKS2020USP

Examples

Run this code
# NOT RUN {
e=FourierBasis(1,1:100,0.01); plot(0.01*(1:100),e,type="l")
e=FourierBasis(0,1,0.01*(1:100)); plot(0.01*(1:100),e,type="l")
FourierBasis(1,1:3,0.1*(1:10))

# }

Run the code above in your browser using DataLab