DSPRelated.com
Forums

Window selection for Hilbert Transformer

Started by Ben Jackson July 25, 2008
I am generating FIR Hilbert transformers with the following code:

        function b = hlbt(n)
            if (rem(n, 2) == 0)
                usage("n must be odd");
            endif
            n = n + 1;
            i = [-n/2+1:n/2-1];
            b = 2/n * (sin(pi*i/2).^2).*cot(pi*i/n);
            b(n/2) = 0;
            b(abs(i)<eps) = 0;
        endfunction

(Which can be derived from the inverse Fourier transform of H=-i*sgn(w).
The even n case has the disadvantage of not having half zero coeffs)

This is a bandpass filter centered on Fs/4 with a bandwidth that increases
with n and 0.5dB ripple at the edges.  If you choose n large enough, you
can push the ripple entirely out of your desired passband.  However, it
is also possible to choose a smaller n and apply a carefully chosen
Kaiser window to get the same performance (in terms of the width of the
passband with a specified ripple limit).

My question, at long last, is:  Why is the Kaiser window particularly good
for this?  Other common windows reduce the "ripple" but narrow the passband
by a similar amount.

A side question is:  Is there a formula or rule of thumb of selecting the
"best" alpha for the Kaiser window for a given degree of Hilbert transformer?

-- 
Ben Jackson AD7GD
<ben@ben.com>
http://www.ben.com/
On Jul 26, 5:15 am, Ben Jackson <b...@ben.com> wrote:
> I am generating FIR Hilbert transformers with the following code: >
For a Hilbert Transformer you need more turns on the secondary for sure. K.
Ben Jackson wrote:
> I am generating FIR Hilbert transformers with the following code: > > function b = hlbt(n) > if (rem(n, 2) == 0) > usage("n must be odd"); > endif > n = n + 1; > i = [-n/2+1:n/2-1]; > b = 2/n * (sin(pi*i/2).^2).*cot(pi*i/n); > b(n/2) = 0; > b(abs(i)<eps) = 0; > endfunction > > (Which can be derived from the inverse Fourier transform of H=-i*sgn(w). > The even n case has the disadvantage of not having half zero coeffs)
I hope you understand that no trig is needed to generate the coefficients. Numbering the coefficients from the center, i.e. from m=-(2-1)/2 to m=+(n-1)/2 with zero in the middle, even coefficients are zero and the odd ones h.m, where k scales the gain.
> This is a bandpass filter centered on Fs/4 with a bandwidth that increases > with n and 0.5dB ripple at the edges. If you choose n large enough, you > can push the ripple entirely out of your desired passband. However, it > is also possible to choose a smaller n and apply a carefully chosen > Kaiser window to get the same performance (in terms of the width of the > passband with a specified ripple limit). > > My question, at long last, is: Why is the Kaiser window particularly good > for this? Other common windows reduce the "ripple" but narrow the passband > by a similar amount.
Because it is a good window in general. I've found that a Nuttall filter is also dandy for this application, but I don't have any theoretical justification. One sometimes has to make a difficult compromise when chosing a windod for a DFT. Good sidelobe performance widens the main lobe, and both can be important. Nature is kinder when suppressing ripple in an FIR. Better DFT sidelobe suppression corresponds to better FIR ripple suppression. Wider DFT main lobe corresponds to gentler FIR cutoff. You can buy that back for a few paltry extra taps.
> A side question is: Is there a formula or rule of thumb of selecting the > "best" alpha for the Kaiser window for a given degree of Hilbert transformer?
That involves the same tradeoffs as choosing a window. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 2008-07-26, Jerry Avins <jya@ieee.org> wrote:
> > I hope you understand that no trig is needed to generate the > coefficients. Numbering the coefficients from the center, i.e. from > m=-(2-1)/2 to m=+(n-1)/2 with zero in the middle, even coefficients are > zero and the odd ones h.m, where k scales the gain.
I'm not sure what happened to your post, but do you mean the odd ones are 2/(m*pi) ? I think I see where I went wrong -- my formulation included a window indirectly. That window had poor behavior when convolved with some other windows. So my general conclusion was wrong. If you start with the simpler un-windowed, much higher ripple version you can then remove ripple just fine with other windows, like Blackman, as you might suspect, without the dramatic tradeoffs I was seeing before. -- Ben Jackson AD7GD <ben@ben.com> http://www.ben.com/
Ben Jackson wrote:
> On 2008-07-26, Jerry Avins <jya@ieee.org> wrote: >> I hope you understand that no trig is needed to generate the >> coefficients. Numbering the coefficients from the center, i.e. from >> m=-(2-1)/2 to m=+(n-1)/2 with zero in the middle, even coefficients are >> zero and the odd ones h.m, where k scales the gain. > > I'm not sure what happened to your post, but do you mean the odd ones > are 2/(m*pi) ? > > I think I see where I went wrong -- my formulation included a window > indirectly. That window had poor behavior when convolved with some > other windows. So my general conclusion was wrong. If you start > with the simpler un-windowed, much higher ripple version you can then > remove ripple just fine with other windows, like Blackman, as you might > suspect, without the dramatic tradeoffs I was seeing before.
I tried to write k/m, where k can be any suitable constant for the gain you want. For unity gain, I think you're right that k -> 2/pi for large n. n needn't actually be odd, but that confition gives the filter an integer-sample delay, allowing the in-phase signal to be read at the middle tap. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:

   ...

> n needn't actually be odd, but that condition gives the filter an > integer-sample delay, allowing the in-phase signal to be read at the > middle tap.
Two more observations: For odd numbers of taps, n = (4k-1), k an positive integer, is the condition to avoid zero end taps. Most windows go to zero at their endpoints. Computing a window that is two taps longer than the filter and discarding both ends avoids that waste. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;