Skip to contents

Accumulates the instantaneous amplitude, or its square, of every mode in the frequency cell of its instantaneous frequency, sample by sample, and integrates the result over time.

Usage

buildHilbertSpectrum(frequency, amplitude, edges, exponent, samplingInterval)

Arguments

frequency

Numeric matrix, samples by modes, of instantaneous frequencies in Hz, finite or NA.

amplitude

Finite non-negative matrix with the dimensions of frequency, the instantaneous amplitudes in the units of the signal.

edges

At least two finite, strictly increasing cell edges in Hz; cell \(b\) is \([e_b, e_{b+1})\). Negative values are admitted. No default.

exponent

The power \(p\): 1 for the amplitude spectrum, 2 for the spectrum weighted by squared amplitude. No default.

samplingInterval

Sampling interval \(\Delta t\) in seconds, a finite number greater than zero.

Details

The spectrum holds the mass of each cell, $$H[n, b] = \sum_{k:\, f_k[n] \in [e_b, e_{b+1})} a_k[n]^p,$$ in units of the signal to the power \(p\). A frequency outside the edges or NA adds nothing. The marginal spectrum of a cell is the time integral \(\Delta t \sum_n H[n, b]\). No scaling or division by the cell width is applied: the values are masses, not densities. The inputs are usually the frequency and amplitude of computeInstantaneousAttributes.

Value

A list with

spectrum

Double matrix, samples by cells, in units of the signal to the power \(p\).

marginal

Numeric vector by cell, in units of the signal to the power \(p\) times seconds.

Examples

Time <- seq(0, 9, length.out = 3000)
Signal <- sin(pi * Time) + sin(2 * pi * Time) + sin(6 * pi * Time) +
    0.5 * Time
Modes <- decomposeEMD(Signal,
                      sifting = list(stopRule = "doubleThreshold"))$modes
Attributes <- computeInstantaneousAttributes(Modes,
                                             samplingInterval = 9 / 2999)
OUT <- buildHilbertSpectrum(Attributes$frequency, Attributes$amplitude,
                            edges = c(1, 2, 3, 4, 5), exponent = 2,
                            samplingInterval = 9 / 2999)
dim(OUT$spectrum)
#> [1] 3000    4
OUT$marginal
#> [1] 3.44528895 4.71656719 4.12037251 0.05831411