public class HilbertTransformFilter
extends java.lang.Object
The sign of the transform (the sign of the 90-degree phase shift) is the same as that for a derivative filter, such that the Hilbert transform of sin(t) is cos(t).
The ideal Hilbert transform filter is infinitely long. The length of the filter used here is chosen to yield less than a specified maximum error for frequencies between specified lower and upper bounds.
Constructor and Description |
---|
HilbertTransformFilter()
Constructs a Hilbert transform filter that yields less than 1% error
for frequencies between 5% and 95% of the Nyquist frequency.
|
HilbertTransformFilter(int nmax,
float emax,
float fmin,
float fmax)
Constructs a Hilbert transform filter that yields less than a specified
maximum error for frequencies between specified lower and upper bounds.
|
public HilbertTransformFilter()
public HilbertTransformFilter(int nmax, float emax, float fmin, float fmax)
nmax
- maximum number of coefficients in filter.
Must be greater than 0.emax
- maximum error.
Must be greater than 0.0.
If the computed filter has fewer than nmax coefficients, then for
frequencies between fmin and fmax, the amplitude spectrum of each
filter will be bounded by 1-emax and 1+emax.
The length of the filter grows approximately as the logarithm of 1/emax.fmin
- minimum frequency (in cycles/sample)
Must be greater than 0.0.
The length of the filter grows approximately as 1/fmin.fmax
- maximum frequency (in cycles/sample).
Must be less than the 0.5 (the Nyquist frequency).
The length of the filter grows approximately as 1/(0.5-fmax).public void apply(int n, float[] x, float[] y)
n
- number of samples in input/output arrays.x
- array[n] of input samples.y
- array[n] of output samples.public int length()