Instantaneous Amplitude, Phase and Frequency
computeInstantaneousAttributes.RdComputes, for each column of a matrix of modes, the analytic signal and its instantaneous amplitude, continuous phase and frequency.
Details
The analytic signal \(z = c + i \mathcal{H} c\) of each column is
computed with the discrete Fourier transform, multiplying each bin by
\(1 + \mathrm{sgn}(\omega)\): positive frequencies are doubled, negative
ones removed, and the zero bin and, for an even number of samples, the
Nyquist bin keep the factor 1, so \(\mathrm{Re}\, z = c\). The transform
implies the periodic extension of the record. The amplitude is
\(a = |z|\). Within each run of samples with \(|z| > 0\), the phase
starts at the principal value of \(\arg z\) and adds the increments
\(\arg(z_{n+1} \bar z_n)\) taken in \((-\pi, \pi]\); a zero of \(z\)
leaves its sample undefined (NA) and the next run starts again at
its principal value. The frequency is
$$f_n = \frac{\phi_{n+1} - \phi_{n-1}}{4 \pi \Delta t}$$
in Hz, the central difference of \(\omega = \phi'\); it is NA where
one of the three phases is, and each border repeats its neighbour. These
local undefined values raise no condition.
Value
A list of three matrices, samples by modes:
- amplitude
Instantaneous amplitude, in the units of the modes.
- phase
Continuous phase in radians,
NAat zeros of the analytic signal.- frequency
Instantaneous frequency in Hz,
NAwhere the phase is undefined.
Examples
SamplingInterval <- 1 / 1000
Time <- seq_len(1000) * SamplingInterval
# Three tones of 2, 24 and 288 Hz as columns.
Tones <- cbind(cos(2 * pi * 2 * Time), 0.25 * cos(2 * pi * 24 * Time),
0.0625 * cos(2 * pi * 288 * Time))
OUT <- computeInstantaneousAttributes(Tones,
samplingInterval = SamplingInterval)
apply(OUT$amplitude, 2, range)
#> [,1] [,2] [,3]
#> [1,] 1 0.25 0.0625
#> [2,] 1 0.25 0.0625
apply(OUT$frequency, 2, range)
#> [,1] [,2] [,3]
#> [1,] 2 24 288
#> [2,] 2 24 288