Learn R Programming

Momocs (version 0.2-03)

hpow: Calculates harmonic power.

Description

hpow is used to estimate the number of harmonics required for the three Fourier methods implemented so far in Momocs: elliptical Fourier analysis (see efourier), radii variation analysis (see tfourier) and tangent angle analysis (see tfourier). It returns and can plot cumulated harmonic power whether dropping the first harmonic or not.

Usage

hpow(Coo, method = c("efourier", "rfourier", "tfourier"),
                 id = 1:Coo@coo.nb, probs = c(0, 0.5, 1), nb.h = 24,
                 drop = 1, smooth.it = 0, plot = TRUE, legend = FALSE,
                 title = "Fourier power spectrum", 
                 lineat.y = c(0.9, 0.95, 0.99, 0.999), bw = 0.1)

Arguments

Coo
The Coo object
method
A character, either "efourier", "rfourier" or "tfourier" (partial matches are allowed) to use to calculate morphological that indicates which method to use.
id
integer. The id of the shape to display. A range of ids can be passed to harm.pow
probs
A vector of numeric, to define quantiles to calculate ; see quantile
nb.h
integer. The maximal number of harmonics to calculate.
drop
logical. Whether to drop the first harmonic for plotting and power calculation.
smooth.it
integer. The number of smoothing iteration to perform.
plot
logical. Whether to plot or not the shape. If FALSE, only the results are returned.
legend
logical. Whether to display a legend box.
title
character. The title to add.
lineat.y
A vector of numeric to specify where to plot dashed lines on the y-axis.
bw
numeric. The width of horizontal segments drawn for each harmonic.

Value

  • Returns a matrix containing cumulated harmonic power for each harmonic.

Details

The power of a given harmonic $n$ is calculated as follows for elliptical Fourier analysis: $$HarmonicPower_n= \frac{A^2_n+B^2_n+C^2_n+D^2_n}{2}$$ and as follows for radii variation and tangent angle: $$HarmonicPower_n= \frac{A^2_n+B^2_n+C^2_n+D^2_n}{2}$$

Examples

Run this code
data(bot)
hpow(bot)

Run the code above in your browser using DataLab