# Difference between revisions of "Contributions:HilbertFilter"

m |
|||

(17 intermediate revisions by 2 users not shown) | |||

Line 1: | Line 1: | ||

==Synopsis== | ==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. | ||

+ | |||

+ | :<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''). | ||

+ | |||

+ | :<math> h(n) = | ||

+ | \begin{cases} | ||

+ | \ \ {2 \over \pi n}, & \mbox{for } n \mbox{ odd}\\ | ||

+ | \ \ 0, & \mbox{for } n \mbox{ even}\\ | ||

+ | \end{cases} | ||

+ | </math> | ||

+ | |||

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

+ | |||

+ | :<math> h(n) = | ||

+ | \begin{cases} | ||

+ | \ \ {2 \over \pi (n-\delta)}, & \mbox{for } n \mbox{ odd}\\ | ||

+ | \ \ 0, & \mbox{for } n \mbox{ even},\\ | ||

+ | \end{cases} | ||

+ | </math> | ||

+ | |||

+ | for <math> 0\leq n \leq N-1 </math>, where ''N'' is an odd number representing the length of the filter in samples, and the resulting Hilbert transform is delayed by a number of samples <math> \delta = (N-1)/2 </math>. The real part of the analytic signal must also be delayed by the same amount in order to estimate the envelope and phase of the input signal. | ||

==Location== | ==Location== | ||

− | + | http://{{SERVERNAME}}/svn/trunk/src/contrib/SignalProcessing/HilbertSignalProcessing/HilbertFilter.cpp | |

==Versioning== | ==Versioning== | ||

===Authors=== | ===Authors=== | ||

− | + | Cristhian Potes, Jeremy Hill | |

− | === | + | ==Parameters== |

− | + | ===OutputSignal=== | |

− | + | This parameter determines which quantity is output from the filter. It may be one of: | |

− | |||

− | |||

− | |||

− | |||

− | |||

;0 - Copy input signal | ;0 - Copy input signal | ||

:no processing, | :no processing, | ||

Line 29: | Line 47: | ||

:original signal filtered with an FIR-Hilbert transformer. | :original signal filtered with an FIR-Hilbert transformer. | ||

+ | ===Delay=== | ||

− | == | + | As for most BCI2000 parameters expressing time, this parameter should be expressed either as a number of SampleBlocks (a bare number without unit) or as a physical length of time with a unit appended (e.g. "0.1s"). |

+ | |||

+ | The length of the Hilbert filter itself is <math> N = 2 \delta + 1 </math> once the delay has been converted to a number of samples <math> \delta </math>. Conversely the delay is <math> \delta = ( N - 1 ) / 2 </math>, where ''N'' is the (odd) number of samples in the filter. Empirically, we have found that ''N'' ≥ 201 samples (i.e. <math>\delta</math> ≥ 100 samples) is advisable for a reasonable-quality approximation to the infinite Hilbert transform. A warning is issued if the delay is shorter than this. | ||

==States== | ==States== |

## Latest revision as of 00:48, 28 March 2012

## Contents

## 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.

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*).

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

for , where *N* is an odd number representing the length of the filter in samples, and the resulting Hilbert transform is delayed by a number of samples . The real part of the analytic signal must also be delayed by the same amount in order to estimate the envelope and phase of the input signal.

## Location

## Versioning

### Authors

Cristhian Potes, Jeremy Hill

## Parameters

### OutputSignal

This parameter determines which quantity is output from the filter. It 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 parameter should be expressed either as a number of SampleBlocks (a bare number without unit) or as a physical length of time with a unit appended (e.g. "0.1s").

The length of the Hilbert filter itself is once the delay has been converted to a number of samples . Conversely the delay is , where *N* is the (odd) number of samples in the filter. Empirically, we have found that *N* ≥ 201 samples (i.e. ≥ 100 samples) is advisable for a reasonable-quality approximation to the infinite Hilbert transform. A warning is issued if the delay is shorter than this.

## States

None.

## See also

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