| fourier | R Documentation |
The Fourier approximation is determined for any function on domain (0, 2\pi) and then graphed.
fourier(f, order = 3, ...)
f |
The function to be approximated by Fourier analysis. |
order |
Integer; the order of the Fourier transformation. |
... |
Optional arguments to be passed to the |
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).
constant |
The constant term. |
cosine.coefficients |
The coefficients for the cosine terms. |
sine.coefficients |
The coefficients for the sine terms. |
The formulas computed within fourier are based on the textbook by Larson (2013).
Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA
Larson, R. (2013) Elementary Linear Algebra, 7th edition.
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) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.