hilbert
Discrete analytical signal using the Hilbert transform.
| Library |
|
Arguments
Input arguments
# xr — input signal
+
vector | the matrix
Details
The input signal is specified as a real vector or matrix. If xr complex, then hilbert ignores the imaginary part of it.
| Data types |
|
# n is the length of the DFT
+
a positive integer scalar
Details
The length of the discrete Fourier transform (DFT), given as a positive integer scalar.
| Data types |
|
Output arguments
# x — analytical signal
+
vector | the matrix
Details
An analytical signal returned as a vector or matrix.
Examples
Sequence analysis signal
Details
Let’s define the sequence and calculate its analytical signal using the function hilbert.
import EngeeDSP.Functions: hilbert
xr = [1 2 3 4]'
x = hilbert(xr)
4×1 Matrix{ComplexF64}:
1.0 + 1.0im
2.0 - 1.0im
3.0 - 1.0im
4.0 + 1.0im
The imaginary part x — this is the Hilbert transformation of the matrix xr and the real part is itself xr.
imx = imag(x)
4×1 Matrix{Float64}:
1.0
-1.0
-1.0
1.0
rex = real(x)
4×1 Matrix{Float64}:
1.0
2.0
3.0
4.0
The second half of the DFT matrix x it is equal to zero. (In this example, the second half of the transformation is just the last element.) The constant component and the Nyquist component in fft(x) they are purely material.
import EngeeDSP.Functions: fft
dft = fft(x)
4-element Vector{ComplexF64}:
10.0 + 0.0im
-4.0 + 4.0im
-2.0 + 0.0im
0.0 + 0.0im
Additional Info
Analytical signal
Details
Function hilbert returns a complex spiral sequence, sometimes called an analytical signal, from a sequence of real data.
Analytical signal it has a real part , which represents the source data, and the imaginary part containing the Hilbert transform. The imaginary part is a version of the original real sequence with a phase shift of 90°. Thus, sines are converted to cosines, and vice versa, cosines are converted to sines. The Hilbert transformed series has the same amplitude and frequency composition as the original sequence. The transformation includes phase information that depends on the phase of the original sequence.
The Hilbert transform is useful for calculating the instantaneous characteristics of a time series, especially the amplitude and frequency. The instantaneous amplitude is the amplitude of the complex Hilbert transform; the instantaneous frequency is the rate of change of the instantaneous phase angle. For a pure sine wave, the instantaneous amplitude and frequency are constant. However, the instantaneous phase is a sawtooth shape reflecting a linear change in the local phase angle over a single period. For mixtures of sinusoids, the attributes are short-term or local averages covering no more than two or three points.
[1] describes the Kolmogorov method for minimum-phase reconstruction, which includes the Hilbert transform of the logarithm of the spectral density of a time series. The toolbar function performs this reconstruction. rceps.
Algorithms
An analytical signal for the sequence xr has a rilateral Fourier transform. That is, the conversion goes to zero for negative frequencies. To approximate the analytical signal, the function hilbert calculates the FFT of the input sequence, replaces the FFT coefficients corresponding to negative frequencies with zeros, and calculates the inverse FFT of the result.
Function hilbert uses a four-step algorithm:
-
Calculate the FFT of the input sequence by storing the result in a vector
x. -
Create a vector
h, whose elements areh(i)have the following values:-
1fori = 1, (n/2)+1; -
2fori = 2, 3, …, (n/2); -
0fori = (n/2)+2, …, n.
-
-
Calculate the piecemeal product
xandh. -
Calculate the inverse FFT of the sequence obtained in step 3 and return the first
nresult elements.
This algorithm was first introduced in [2]. The method assumes that the input signal is x it represents a finite block of data. This assumption allows the function to accurately eliminate spectral redundancy by x. FIR filtering methods can only approximate the analytical signal, but their advantage lies in the continuity of data processing.
Literature
-
Claerbout, Jon F. Fundamentals of Geophysical Data Processing with Applications to Petroleum Prospecting. Oxford, UK: Blackwell, 1985.
-
Marple, S. L. «Computing the Discrete-Time Analytic Signal via FFT.» IEEE® Transactions on Signal Processing. Vol. 47, 1999, pp. 2600–2603.
-
Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. 2nd Ed. Upper Saddle River, NJ: Prentice Hall, 1999.