efourier
computes elliptical Fourier analysis from a matrix or a list of coordinates.efourier(coo, nb.h = 32, smooth.it = 0, silent = FALSE)
list
or a matrix
of coordinates.integer
. The number of harmonics to useinteger
. The number of smoothing iterations to perform.logical
. Whether to print or not diagnosis messages.vector
of $a_{1->n}$ harmonic coefficients.vector
of $b_{1->n}$ harmonic coefficients.vector
of $c_{1->n}$ harmonic coefficients.vector
of $d_{1->n}$ harmonic coefficients.ao
Harmonic coefficient.co
Harmonic coefficient.Coo
-objects.
Elliptic Fourier analysis and normalization are calculated as follows. Let $T$ be the perimeter of a given closed outline, here considered as the period of the signal. One sets $\omega = 2\pi/T$ to be the pulse. Then, the curvilinear abscissa, $t$ varies from $0$ to $T$. One can express $x(t)$ and $y(t)$ as:
$$x(t) = \frac{a_0}{2}+\sum\limits_{n=1}^{+\infty} a_n\cos n\omega t + b_n\sin n\omega t$$
with
$$a_n = \frac{2}{T}+ \int\limits_{0}^{T} x(t)\cos (n\omega t) \mathrm{d} t$$
$$b_n = \frac{2}{T}+ \int\limits_{0}^{T} x(t)\sin (n\omega t) \mathrm{d} t$$
similarly,
$$y(t) = \frac{c_0}{2}+\sum\limits_{n=1}^{+\infty} c_n\cos n\omega t + d_n\sin n\omega t$$
with
$$c_n = \frac{2}{T}+ \int\limits_{0}^{T} y(t)\cos (n\omega t) \mathrm{d} t$$
$$d_n = \frac{2}{T}+ \int\limits_{0}^{T} y(t)\sin (n\omega t) \mathrm{d} t$$
Since the outline contains a $k$ finite number of points, one can therefore calculate discrete estimators for every harmonic coefficient of the $n^{th}$ harmonics:
$$a_n=\frac{T}{2\pi^2n^2}\sum\limits_{p=1}^k \frac{\Delta x_p}{\Delta t_p}(\cos\frac{2\pi nt_p}{T}-\cos\frac{2\pi nt_{p-1}}{T})$$
$$b_n=\frac{T}{2\pi^2n^2}\sum\limits_{p=1}^k \frac{\Delta x_p}{\Delta t_p}(\sin\frac{2\pi nt_p}{T}-\sin\frac{2\pi nt_{p-1}}{T})$$
$\Delta x_1=x_1-x_k$ and $c_n$ and $d_n$ are calculated similarly. $a_0$ and $c_0$ correspond to the estimate of the coordinates of the centroid of original outline and are estimated by:
$$a_0=\frac{2}{T}\sum\limits_{i=1}^p x_i$$
and
$$c_0=\frac{2}{T}\sum\limits_{i=1}^p y_i$$
Intuitively, for all positive integers $n$, the sum of a cosine curve and a sine curve represent the $n^{th}$ harmonic content of the $x$ and $y$ projections of the $k$-edged polygon, and for any $n$, these two curves define an ellipse in the plane. Ferson and colleagues noticed that in the "time" it takes the $n^{th}$ harmonic to traverse its ellipse $n$ times, the $(n+1)^{th}$ harmonic has traversed its own ellipse $n+1$ times. The reconstruction of the original polygon is done by vector adding these ellipses for all harmonics, which echoes astronomical Ptolemy's epicycles (see Ptolemy), and the reconstruction obtained from $N$ harmonics is the best possible fit in a least-squares sense.Coo
objects. Ptolemy for an implementation of the Ptolemaic ellipses. rfourier, tfourier for the other members of the Fourier's family.data(bot)
coo <- bot@coo[[1]]
coo.plot(coo)
ef <- efourier(coo, 12)
ef
efi <- efourier.i(ef)
l2m(efi)
coo.draw(efi, border="red", col=NA)
Run the code above in your browser using DataLab