Learn R Programming

Momocs (version 0.2-03)

efourier: Calculates elliptical Fourier analysis.

Description

efourier computes elliptical Fourier analysis from a matrix or a list of coordinates.

Usage

efourier(coo, nb.h = 32, smooth.it = 0, silent = FALSE)

Arguments

coo
A list or a matrix of coordinates.
nb.h
integer. The number of harmonics to use
smooth.it
integer. The number of smoothing iterations to perform.
silent
logical. Whether to print or not diagnosis messages.

Value

  • A list with these components:
  • anvector of $a_{1->n}$ harmonic coefficients.
  • bnvector of $b_{1->n}$ harmonic coefficients.
  • cnvector of $c_{1->n}$ harmonic coefficients.
  • dnvector of $d_{1->n}$ harmonic coefficients.
  • aoao Harmonic coefficient.
  • coco Harmonic coefficient.

Details

These functions and their mathematical background detailed below are here detailed to ease their use in new methods but are used internally by methods on 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.

References

Claude, J. (2008) Morphometrics with R, Use R! series, Springer 316 pp. Ferson S, Rohlf FJ, Koehn RK. 1985. Measuring shape variation of two-dimensional outlines. Systematic Biology 34: 59-68.

See Also

efourier.i for the reverse operation and eFourier the method for Coo objects. Ptolemy for an implementation of the Ptolemaic ellipses. rfourier, tfourier for the other members of the Fourier's family.

Examples

Run this code
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