Hilbert transform
Computes the extension of a real valued signal to an analytic signal.
hilbert(x, n = ifelse(is.vector(x), length(x), nrow(x)))
x |
Input array, specified as a vector or a matrix. In case of a matrix, the Hilbert transform of all columns is computed. |
n |
use an n-point FFT to compute the Hilbert transform. The input data is zero-padded or truncated to length n, as appropriate. |
The function returns returns a complex helical sequence, sometimes called the analytic signal, from a real data sequence. The analytic signal has a real part, which is the original data, and an imaginary part, which contains the Hilbert transform. The imaginary part is a version of the original real sequence with a 90 degrees phase shift. Sines are therefore transformed to cosines, and conversely, cosines are transformed to sines. The Hilbert-transformed series has the same amplitude and frequency content as the original sequence. The transform includes phase information that depends on the phase of the original.
Analytic signal, of length n
, returned as a complex vector or
matrix, the real part of which contains the original signal, and the
imaginary part of which contains the Hilbert transform of x
.
Paul Kienzle, pkienzle@users.sf.net,
Peter L. Soendergaard.
Conversion to R by Geert van Boxtel, gjmvanboxtel@gmail.com
## notice that the imaginary signal is phase-shifted 90 degrees t <- seq(0, 10, length = 256) z <- hilbert(sin(2 * pi * 0.5 * t)) plot(t, Re(z), type = "l", col="blue") lines (t, Im(z), col = "red") legend('topright', lty = 1, legend = c("Real", "Imag"), col = c("blue", "red")) ## the magnitude of the hilbert transform eliminates the carrier t <- seq(0, 10, length = 1024) x <- 5 * cos(0.2 * t) * sin(100 * t) plot(t, x, type = "l", col = "green") lines (t, abs(hilbert(x)), col = "blue") legend('topright', lty = 1, legend = c("x", "|hilbert(x)|"), col = c("green", "blue"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.