Difference between revisions of "Contributions:HilbertFilter"

From BCI2000 Wiki
Jump to: navigation, search
m (Delay)
(Synopsis)
Line 3: Line 3:
 
This filter computes the envelope or the phase of a signal using Hilbert transform. The discrete input signal  ''x''(''n'') is first transformed to its analytic representation (i.e., analytic signal), which is composed of real and imaginary parts.
 
This filter computes the envelope or the phase of a signal using Hilbert transform. The discrete input signal  ''x''(''n'') is first transformed to its analytic representation (i.e., analytic signal), which is composed of real and imaginary parts.
  
:<math> x_{a}(n) = \operatorname{Re}(x(n)) + \operatorname{Im}(x(n))  </math>
+
:<math> x_{a}(n) = x(n) + j \operatorname{H}(x(n))  </math>
  
 
The real part is the same input signal, and the imaginary part is the Hilbert transform of the input signal. The Hilbert transform is implemented as the convolution of the input signal with the filter ''h''(''n'').  
 
The real part is the same input signal, and the imaginary part is the Hilbert transform of the input signal. The Hilbert transform is implemented as the convolution of the input signal with the filter ''h''(''n'').  

Revision as of 21:17, 26 March 2012

Synopsis

This filter computes the envelope or the phase of a signal using Hilbert transform. The discrete input signal x(n) is first transformed to its analytic representation (i.e., analytic signal), which is composed of real and imaginary parts.

 x_{a}(n) = x(n) + j \operatorname{H}(x(n))

The real part is the same input signal, and the imaginary part is the Hilbert transform of the input signal. The Hilbert transform is implemented as the convolution of the input signal with the filter h(n).

 h(n) =  
\begin{cases}
\ \ {2 \over \pi n}, & \mbox{for } n \mbox{ odd}\\
\ \ 0, & \mbox{for } n \mbox{ even}\\
\end{cases}

To get an ideal Hilbert transform, n must be infinitely long (-\infty < n < \infty). However, for real time implementations, h(n) must be truncated and delayed to guarantee a causal filter. Thus, the FIR filter is defined as

 h(n) =  
\begin{cases}
\ \ {2 \over \pi (n-\frac{N-1}{2})}, & \mbox{for } n \mbox{ odd}\\
\ \ 0, & \mbox{for } n \mbox{ even},\\
\end{cases}

for  0\leq n \leq N-1 , where N must be an odd number representing the length of the filter. The resulting Hilbert transform is delayed by  \delta = \frac{N-1}{2} implying that the real part of the analytic signal must be delayed by the same amount too in order to estimate the envelope and phase of the input signal.

Location

Not yet released: will be released at http://www.bci2000.org/svn/trunk/src/contrib/SignalProcessing/HilbertSignalProcessing/HilbertFilter.cpp

Versioning

Authors

Cristhian Potes, Jeremy Hill

Source Code Revisions

  • Initial development:
  • Tested under:
  • Known to compile under:
  • Broken since:

Parameters

OutputSignal

This parameter may be one of

0 - Copy input signal
no processing,
1 - Magnitude
Hilbert envelope amplitude,
2 - Phase
Hilbert phase,
3 - Real part
original input signal, but with a delay to match its timing to the imaginary part.
4 - Imaginary part
original signal filtered with an FIR-Hilbert transformer.

Delay

As for most BCI2000 parameters expressing time, this is expressed either as a number of SampleBlocks (bare number) or as a physical length of time with a unit appended (e.g. "0.1s").

The length of the Hilbert filter itself is  N = 2 \delta + 1 with delay  \delta expressed in samples. Conversely the delay is  \delta = (N-1)/2 , where N is the (odd) number of samples in the filter.

States

None.

See also

User Reference:Filters, Contributions:SignalProcessing, Contributions:HilbertSignalProcessing