This function computes the scale index of a signal in the scale interval \([s_0,s_1]\), for a given set of scale parameters \(s_1\) and taking \(s_0\) as the minimum scale (see Benítez et al. 2010).
The scale index of a signal in the scale interval \([s_0,s_1]\) is given by the quotient $$\frac{S(s_{min})}{S(s_{max})},$$ where \(S\) is the scalogram, \(s_{max} \in [s_0,s_1]\) is the smallest scale such that \(S(s)\le S(s_{max})\) for all \(s \in [s_0,s_1]\), and \(s_{min} \in [s_{max},2s_1]\) is the smallest scale such that \(S(s_{min})\le S(s)\) for all \(s \in [s_{max},2s_1]\).
scale_index(signal = NULL,
scalog = NULL,
dt = 1,
scales = NULL,
powerscales = TRUE,
s1 = NULL,
wname = c("MORLET", "DOG", "PAUL", "HAAR", "HAAR2"),
wparam = NULL,
waverad = NULL,
border_effects = c("BE", "INNER", "PER", "SYM"),
makefigure = TRUE,
figureperiod = TRUE,
plot_scalog = FALSE,
xlab = NULL,
ylab = "Scale index",
main = "Scale Index")
A list with the following fields:
si
: A vector with the scale indices.
s0
: The scale \(s_0\).
s1
: A vector with the scales \(s_1\).
smax
: A vector with the scales \(s_{max}\).
smin
: A vector with the scales \(s_{min}\).
scalog
: A vector with the scalogram from which the scale indices are
computed.
scalog_smax
: A vector with the maximum scalogram values \(S(s_{max})\).
scalog_smin
: A vector with the minimum scalogram values \(S(s_{min})\).
fourierfactor
: A factor for converting scales into periods.
A vector containing the signal whose scale indices are wanted.
A vector containing the scalogram from which the scale indices are going
to be computed. If scalog
is not NULL
, then signal
, waverad
and border_effects
are not necessary and they are ignored.
Numeric. The time step of the signals.
A vector containing the wavelet scales at wich the scalogram
is computed. This can be either a vector with all the scales or, following Torrence
and Compo 1998, a vector of 3 elements with the minimum scale, the maximum scale and
the number of suboctaves per octave (in this case, powerscales
must be TRUE in
order to construct power 2 scales using a base 2 logarithmic scale). If scales
is NULL, they are automatically constructed.
Logical. It must be TRUE (default) in these cases:
If scales
are power 2 scales, i.e. they use a base 2 logarithmic scale.
If we want to construct power 2 scales automatically. In this case, scales
must be NULL
.
If we want to construct power 2 scales from scales
. In this case,
length(scales)
must be 3.
A vector containing the scales \(s_1\). The scale indices are computed in
the intervals \([s_0,s_1]\), where \(s_0\) is the minimum scale in scales
.
If s1
are not power 2 scales, then scales
should not be power 2 scales
either and hence, powerscales
must be FALSE
.
A string, equal to "MORLET", "DOG", "PAUL", "HAAR" or "HAAR2". The difference between "HAAR" and "HAAR2" is that "HAAR2" is more accurate but slower.
The corresponding nondimensional parameter for the wavelet function (Morlet, DoG or Paul).
Numeric. The radius of the wavelet used in the computations for the cone of influence. If it is not specified, it is asumed to be \(\sqrt{2}\) for Morlet and DoG, \(1/\sqrt{2}\) for Paul and 0.5 for Haar.
A string, equal to "BE", "INNER", "PER" or "SYM", which indicates how to manage the border effects which arise usually when a convolution is performed on finite-lenght signals.
"BE": With border effects, padding time series with zeroes.
"INNER": Normalized inner scalogram with security margin adapted for each different scale.
"PER": With border effects, using boundary wavelets (periodization of the original time series).
"SYM": With border effects, using a symmetric catenation of the original time series.
Logical. If TRUE (default), a figure with the scale indices is plotted.
Logical. If TRUE (default), periods are used in the figure instead of scales.
Logical. If TRUE, it plots the scalogram from which the scale indices are computed.
A string giving a custom X axis label. If NULL (default) the X label is
either "s1" or "Period of s1" depending on the value of figureperiod
.
A string giving a custom Y axis label.
A string giving a custom main title for the figure.
R. Benítez, V. J. Bolós, M. E. Ramírez. A wavelet-based tool for studying non-periodicity. Comput. Math. Appl. 60 (2010), no. 3, 634-641.
dt <- 0.1
time <- seq(0, 50, dt)
signal <- c(sin(pi * time), sin(pi * time / 2))
si <- scale_index(signal = signal, dt = dt)
# Another way, giving the scalogram instead of the signal:
sc <- scalogram(signal = signal, dt = dt, energy_density = FALSE, makefigure = FALSE)
si <- scale_index(scalog = sc$scalog, scales = sc$scales, dt = dt)
Run the code above in your browser using DataLab