scalogram: Scalogram of a signal

Description Usage Arguments Value References Examples

View source: R/scalogram.R

Description

This function computes the normalized scalogram of a signal for the scales given. It is important to note that the notion of scalogram here is analogous to the spectrum of the Fourier transform. It gives the contribution of each scale to the total energy of the signal. For each scale s, it is defined as the square root of the integral of the squared modulus of the wavelet transform w.r.t. the time variable t, i.e.

S(s):=(integral_{-∞}^{+∞}|Wf(t,s)|^2 dt)^{1/2}.

"Normalized" means that the scalogram is divided by the square root of the number of times, for comparison purposes between different values of the parameter border_effects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
scalogram(signal,
                 dt = 1,
                 scales = NULL,
                 powerscales = TRUE,
                 wname = c("MORLET", "DOG", "PAUL", "HAAR", "HAAR2"),
                 wparam = NULL,
                 waverad = NULL,
                 border_effects = c("BE", "INNER", "PER", "SYM"),
                 energy_density = TRUE,
                 makefigure = TRUE,
                 figureperiod = TRUE,
                 xlab = NULL,
                 ylab = "Scalogram",
                 main = "Scalogram")

Arguments

signal

A vector containing the signal whose scalogram is wanted.

dt

Numeric. The time step of the signal.

scales

A vector containing the wavelet scales at wich the scalogram is computed. This can be either a vector with all the scales, or (if powerscales is TRUE) following Torrence and Compo 1998, a vector of three elements with the minimum scale, the maximum scale and the number of suboctaves per octave. If NULL, they are automatically computed.

powerscales

Logical. If TRUE (default), construct power 2 scales from scales. If scales is NULL, they are automatically computed.

wname

A string, equal to "MORLET", "DOG", "PAUL", "HAAR" or "HAAR2". The difference between "HAAR" and "HAAR2" is that "HAAR2" is more accurate but slower.

wparam

The corresponding nondimensional parameter for the wavelet function (Morlet, DoG or Paul).

waverad

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 √{2} for Morlet and DoG, 1/√{2} for Paul and 0.5 for Haar.

border_effects

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.

energy_density

Logical. If TRUE (default), divide the scalogram by the square root of the scales for convert it into energy density.

makefigure

Logical. If TRUE (default), a figure with the scalogram is plotted.

figureperiod

Logical. If TRUE (default), periods are used in the figure instead of scales.

xlab

A string giving a custom X axis label. If NULL (default) the X label is either "Scale" or "Period" depending on the value of figureperiod.

ylab

A string giving a custom Y axis label.

main

A string giving a custom main title for the figure.

Value

A list with the following fields:

References

C. Torrence, G. P. Compo. A practical guide to wavelet analysis. B. Am. Meteorol. Soc. 79 (1998), 61<e2><80><93>78.

V. J. Bol<c3><b3>s, R. Ben<c3><ad>tez, R. Ferrer, R. Jammazi. The windowed scalogram difference: a novel wavelet tool for comparing time series. Appl. Math. Comput., 312 (2017), 49-65.

Examples

1
2
3
4
dt <- 0.1
time <- seq(0, 50, dt)
signal <- c(sin(pi * time), sin(pi * time / 2))
scalog <- scalogram(signal = signal, dt = dt, border_effects = "INNER")

wavScalogram documentation built on May 24, 2019, 5:03 p.m.