Learn R Programming

jmuOutlier (version 2.2)

fourier: Determining and Graphing Fourier Approximation

Description

The Fourier approximation is determined for any function on domain \((0, 2\pi)\) and then graphed.

Usage

fourier(f, order = 3, ...)

Arguments

f

The function to be approximated by Fourier analysis.

order

Integer; the order of the Fourier transformation.

Optional arguments to be passed to the plot function (see par).

Value

constant

The constant term.

cosine.coefficients

The coefficients for the cosine terms.

sine.coefficients

The coefficients for the sine terms.

Details

The numerical output consists of \(a_0/2, a_1, ..., a_n, b_1, ..., b_2.\) The equation is (constant) \(+ a_1 cos(x) + ... + a_n cos(n x) + b_1 sin(x) + ... + b_n sin(n x).\)

References

Larson, R. (2013) Elementary Linear Algebra, 7th edition.

Examples

Run this code
# NOT RUN {
par( mfrow=c(2,2) )
fourier( function(x){ exp(-x)*(x-pi) }, 4 )
fourier( function(x){ exp(-x) }, 7 )
fourier( function(x){ (x-pi) }, 5 )
fourier( function(x){ (x-pi)^2 } )
par( mfrow=c(1,1) )
# }

Run the code above in your browser using DataLab