|See Also||linfir , pwlfir , rcfir , srrcfir , pbfir|
Ntaps = INPUT, scalar, any numerical type. Filter length in
[taps]. Coerced to INTEGER.
wintype = INPUT, string. One of ["RECTANGULAR"|
winparam = INPUT, scalar, any numerical type. Parameter
used by GAUSSIAN or KAISER window functions.
Coerced to DOUBLE.
RETURN: Returns DOUBLE column vector Hilbert Transformer FIR
filter of length Ntaps.
Designs and returns a Hilbert transformer FIR digital filter as a column vector.
Creates a linear phase, windowed Hilbert Transformer FIR filter of length 'Ntaps'. Function returns a column vector of type DOUBLE. 'Ntaps' may be of any numerical type and is coerced to INTEGER before local processing. 'Ntaps' must be ODD-valued, and must be >=3 or novalue is returned.
The ideal Hilbert transformer is a filter with unity gain and a phase shift of 90 degrees at all frequencies. The Hilbert transform is useful in creating 'analytic' signals and generally where quadrature related signals are required. The Hilbert transform of a sinewave is another sinewave delayed by 90 degrees. The Hilbert transformer FIR has an additional delay of (Ntaps-1)/2 samples due to the causality of the filter.
A window function may be applied to the resulting FIR filter. 'wintype' is a string specifying the window type to be applied. 'winparam' is the numerical parameter used with the GAUSSIAN and KAISER window functions. If you leave off 'wintype' and 'winparam', a "RECTANGULAR" window is assumed. For windows other than "GAUSSIAN" and "KAISER", 'winparam' may be omitted. Error handling is done by 'winddata()' function.
The filter taps are:
Ntaps = 31 # Number of taps
win = "TRIANGULAR"; # Window Type
fs = 10d3 # sampling rate
h = hilbert(Ntaps,win) # HAMMING
t = seq(Ntaps)-1d0; # Tap index
M = 100; # Number points for freq response
fmin = 10d0; # freq min plot
fmax = fs/2-1d0; # freq max plot
df = (fmax-fmin)/M; # freq increment
f = (seq(M+1)-1d0)/M*fs/2d0; # freq vector
HdB = db20(gainz(h,1,f,fs)); # dB response
Plots of the filter and it's frequency response are:
Stearns & David