Discrete-time analytic signal using Hilbert transform

`x = hilbert(xr)`

`x = hilbert(xr,n)`

The analytic signal for a sequence `xr`

has a *one-sided
Fourier transform*. That is, the transform vanishes for negative
frequencies. To approximate the analytic signal, `hilbert`

calculates
the FFT of the input sequence, replaces those FFT coefficients that correspond to
negative frequencies with zeros, and calculates the inverse FFT of the result.

`hilbert`

uses a four-step algorithm:

Calculate the FFT of the input sequence, storing the result in a vector

`x`

.Create a vector

`h`

whose elements`h(i)`

have the values:1 for

`i`

= 1,`(n/2)+1`

2 for

`i`

= 2, 3, ... ,`(n/2)`

0 for

`i`

=`(n/2)+2`

, ... ,`n`

Calculate the element-wise product of

`x`

and`h`

.Calculate the inverse FFT of the sequence obtained in step 3 and returns the first

`n`

elements of the result.

This algorithm was first introduced in [2]. The
technique assumes that the input signal, `x`

, is a finite block of
data. This assumption allows the function to remove the spectral redundancy in
`x`

exactly. Methods based on FIR filtering can only approximate
the analytic signal, but they have the advantage that they operate continuously on the
data. See Single-Sideband Amplitude Modulation for another example of a Hilbert transform computed
with an FIR filter.

[1] Claerbout, Jon F. *Fundamentals of Geophysical
Data Processing with Applications to Petroleum Prospecting*. Oxford, UK:
Blackwell, 1985, pp. 59–62.

[2] Marple, S. L. “Computing the Discrete-Time Analytic
Signal via FFT.” *IEEE ^{®} Transactions on Signal Processing*. Vol. 47, 1999, pp.
2600–2603.

[3] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck.
*Discrete-Time Signal Processing*. 2nd Ed. Upper Saddle River,
NJ: Prentice Hall, 1999.