calculates the Hilbert Transform of a 1-D signal
Hilbert( signal, fftlength )
(optional) non-negative integer. The default is numelems(signal).
The Hilbert command takes a 1-D rtable, and computes the (Discrete) Hilbert Transform. The continuous version is defined by a convolution with the function t↦1π⋅t, and for signal f⁡t, the Hilbert Transform is given by
where the integral uses the Cauchy Principle Value.
The passed container is converted to an Array of complex datatype. For this reason, it is most efficient for the container to have this datatype beforehand. However, the signal needs to be real-valued, and if a complex rtable is passed, the imaginary parts must be zero.
The fftlength option determines the length of the Arrays used with Discrete Fourier Transforms (DFTs). If fftlength is greater than the size of signal, then padding is used, and if fftlength is smaller than the size of signal, truncation is performed. The default value is numelems(signal). Note that the ideal value for using Fast Fourier Transforms (FFTs) is the smallest power of two that is at least 4 and no smaller than the size of signal, that is, 2^(-ilog2(1/max(4,numelems(signal)))).
An Array of size fftlength is returned, with the real part being the modified (padded or truncated) signal, and the imaginary part being the corresponding Hilbert Transform.
Since DFTs are used to find the Hilbert Transform, there may be numerical artifacts in the result that are small in size.
To obtain the Hilbert Transform, we use the algorithm outlined by S.L. Marple (see references below):
Pad with zeros or truncate signal so that the modified signal f has size n=fftlength.
Compute F, the DFT of f.
Construct G, the Finite Impulse Response (FIR) signal, as follows. First, define k=ceil(n/2)+1. Now, initialize an Array G of size n filled with zeros, and then set G=1, G[i]=2 for i=2..k-1, and, if n is even, G[k]=1. Note that H[i]=0 for i=k+1..n corresponds to the filtering out of negative frequencies.
Define H to be the element-wise product of F and G.
Take the Inverse DFT (IDFT) of H, which returns the Hilbert Transform h of signal.
Consider the following simple signal:
A ≔ Array⁡1,2,3,4
Different values of fftlength give different results (here, the default is 4):
However, when you increase fftlength, the first four elements converge:
Here, we generate a discrete signal from a continuous one. First, define the time bounds and signal:
t1 ≔ −10.0
t2 ≔ 10.0:
f ≔ t→10t2+1
Second, define the number of points, along with the sample time and signal values:
n ≔ 64:
φ ≔ i→t1+i−1⁢t2−t1n−1:
T ≔ Array⁡`~`φ⁡seq⁡1..n:
A ≔ Array⁡`~`f⁡T,datatype=float8:
Now, we can find and plot the Hilbert Transform:
B ≔ Hilbert⁡A:
p ≔ dataplot⁡ℜ,ℑ⁡B,legend=Original signal,Transformed signal,title=Discrete Signals vs. Index,color=blue,red,symbolsize=7,font=Verdana,15,legendstyle=font=Verdana,10
The time values are in terms of the indices, but we can transform the plot:
plots:-display⁡plottools:-transform⁡i,x→φ⁡i,x⁡p,title=Discrete Signals vs. Time
For comparison, let's determine the Continuous Hilbert Transform, which is fairly simple for this example:
F ≔ unapply⁡1⁢int⁡f⁡τt−τ,τ=−∞..∞,CauchyPrincipalValuePi,tassumingt::real
p ≔ plot⁡f⁡t,F⁡t,t=t1..t2,legend=Original signal,Transformed signal,title=Continuous Signals vs. Time,color=blue,red,symbolsize=7,font=Verdana,15,legendstyle=font=Verdana,10
Marple, S.L., Jr. "Computing the Discrete-Time "Analytic" Signal via FFT." IEEE Transactions on Signal Processing. Vol. 47, No. 9, 1999.
The SignalProcessing[Hilbert] command was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
Download Help Document