Reply by Fred Marshall March 15, 20052005-03-15
"jfgagne" <jfgagne@amphitech.com> wrote in message 
news:Kr6dnfRfTtopZbDfRVn-sw@giganews.com...
> Hello everyone, > > I would like to confirm that even with a large number of coefficients it > is not possible to make a Halfband filter with narrow transition > bandwidth? > Ex.: Fpass=7MHz(-1dB tolerated), Fstop=8.125MHz with Astop=80dB > using Fsampling = 32.5 MHz > > I tried a few software tools and I couldn't calculate this filter. It > seems to me that I have to make it using a polyphase FIR. > > My goal was to use Halfband in order to minimize FPGA ressources!
JF, You got some good responses and perhaps some good private correspondence as well. In order to minimize FPGA resources I've built "halfband" filters using sums of powers of two coefficients. So, no multiplies, just shifts and adds. Ours were relatively short filters for video and there may be things in the FPGAs today that make multiplies cheaper... We simply started with halfband filter coefficients and quantized them. The center coefficient was always 0.5 or 1.0 (so no quantization) and we went from there accepting the errors in filter response that quantization caused. Of course, these filters were halfband exactly by definition*. And, one of the advantages is that almost half of the coefficients are zero and they are symmetric. *If you are wondering why that would be the case: Every pair of coefficients equidistant from the center of the filter provides an odd cosine term in the frequency response. All of these are zero at fs/4. Imagine the filter response F' without the center coefficient (which provides a constant term in frequency). Then the filter is antisymmetric around zero and fs/4 (it goes negative at fs/4 and goes positive again at 3fs/4 and looks like a zero-average "square wave" in frequency). The frequency response at f=0 is the sum of the coefficients. So F'(0) is the sum of the coefficients yeilding F'. If the constant coefficient is added that is equal to the sum of the other coefficients then it "raises" the frequency response by F'(0) so that the new response F(0) is 2*F'(0) and the response at fs/4 is F'(0) and the response at fs/2 is -F(fs/2) = [F'(0) + F'(0)] = 0 which is a nice way to define a halfband filter. Note that it isn't necessary that F(fs/2) be exactly zero. In fact, in minimax design it would be normal for the value at f=0 to be not 1.0 (if that is the passband criterion) but equal to one of the peaks of the error. Then, if the filter is antisymmetric as it should be, the value at fs/2 will be away from zero by the same amount. So, the process mentioned above doesn't generate the very best minimax filter - only a pretty good minimax filter because the end points are unecessarily constrained. A better minimax design will result if we allow the response at f=0 to differ from the desired response. Fred
Reply by Rick Lyons March 14, 20052005-03-14
On Fri, 11 Mar 2005 10:34:26 -0500, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>in article 4231ae3a.264906781@news.sf.sbcglobal.net, Rick Lyons at >r.lyons@_BOGUS_ieee.org wrote on 03/11/2005 09:43: > >> On Tue, 08 Mar 2005 15:23:06 -0500, robert bristow-johnson >> <rbj@audioimagination.com> wrote: >> >??? >> >> (snipped) >> >> Hi, >> this crappy Usenet software!! >> >> I know Jean-Frederic personally, and I cannot >> see his original post! Darn. > >there's always Google Groups. >http://groups-beta.google.com/group/comp.dsp/msg/2301df2a77f59c6c
Hi R B-J, thanks. I'll use that "Google Groups" when I think I've missed an important post.
>how did you extrapolate "Jean-Frederic" from jfgagne <jfgagne@amphitech.com> >without seeing his post?
Well, I was at his company in Canada, and met him, last January. He's a good guy. He sent me a private E-mail about halfband filters, but he didn't send any frequency specs that *might* have allowed me to detect his problem of not specifying the center of the transition band exactly at Fs/4. [-Rick-]
Reply by robert bristow-johnson March 11, 20052005-03-11
in article 4231ae3a.264906781@news.sf.sbcglobal.net, Rick Lyons at
r.lyons@_BOGUS_ieee.org wrote on 03/11/2005 09:43:

> On Tue, 08 Mar 2005 15:23:06 -0500, robert bristow-johnson > <rbj@audioimagination.com> wrote: >
???
> > (snipped) > > Hi, > this crappy Usenet software!! > > I know Jean-Frederic personally, and I cannot > see his original post! Darn.
there's always Google Groups. http://groups-beta.google.com/group/comp.dsp/msg/2301df2a77f59c6c how did you extrapolate "Jean-Frederic" from jfgagne <jfgagne@amphitech.com> without seeing his post?
> I sent Jean-Frederic some MATLAB software that > I hopes helps a little.
wunnerful. if i had heard him request it, i could have done the same. or post it here. all you really need to do is specify a perfectly symmetrical frequency response (odd symmetry about Nyquist/4), with symmetrical weighting, to remez() or firls() and it designs it. because of numerical issues, the "zero" taps won't be exactly zero, so just kill them. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by Rick Lyons March 11, 20052005-03-11
On Tue, 08 Mar 2005 15:23:06 -0500, robert bristow-johnson
<rbj@audioimagination.com> wrote:



  (snipped)

Hi,
  this crappy Usenet software!!

I know Jean-Frederic personally, and I cannot 
see his original post!  Darn.

I sent Jean-Frederic some MATLAB software that 
I hopes helps a little.

[-Rick-]

Reply by Symon March 10, 20052005-03-10
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:BE55CC7D.51FC%rbj@audioimagination.com...
> > my old MATLAB doesn't have gremez() that i know of. i have used the > regular > remez() to split up a band and apply a set of differing magnitudes and > weights to different frequencies and it has worked pretty well. i can't > really tell what is the difference between the two remezs, with or without > the g. what, explicitly, is the difference?
Hi Robert, gremez, or generalised remez, has a few extra bells and whistles to do stuff like fix the gain at a frequency point. If you want more info, I could email you the manual page, just let me know. There's also a cremez. For "Complex and nonlinear phase equiripple FIR filter design". Best, Syms
Reply by robert bristow-johnson March 10, 20052005-03-10
in article 39agtlF60h5mrU1@individual.net, Symon at symon_brewer@hotmail.com
wrote on 03/10/2005 04:05:

> Hi Robert, > So in Matlab there's a function gremez. > From the help:- > b = gremez(n,f,a,w) returns a length n+1 linear phase FIR filter which has > the best approximation to the desired frequency response described by f and > a in the minimax sense. w is a vector of weights, one per band. When you > omit w, all bands are weighted equally. > > One weight per band was no good to me, I wanted to change the weights > gradually over the whole frequency grid. You _can_ get gremez to call a > function to generate an arbitrary frequency response, but not for the > weighting function.
my old MATLAB doesn't have gremez() that i know of. i have used the regular remez() to split up a band and apply a set of differing magnitudes and weights to different frequencies and it has worked pretty well. i can't really tell what is the difference between the two remezs, with or without the g. what, explicitly, is the difference? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by Symon March 10, 20052005-03-10
Hi Robert,
So in Matlab there's a function gremez.
From the help:-
b = gremez(n,f,a,w) returns a length n+1 linear phase FIR filter which has 
the best approximation to the desired frequency response described by f and 
a in the minimax sense. w is a vector of weights, one per band. When you 
omit w, all bands are weighted equally.

One weight per band was no good to me, I wanted to change the weights 
gradually over the whole frequency grid. You _can_ get gremez to call a 
function to generate an arbitrary frequency response, but not for the 
weighting function.
So, maybe I'm not quite so mad after all? (Yeah, right!)
Cheers, Syms.

"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:BE551367.51C8%rbj@audioimagination.com...
> in article 3990olF5v573eU1@individual.net, Symon at > symon_brewer@hotmail.com > wrote on 03/09/2005 14:23: > >> The Perl >> program is useful for tampering with the weighting function, IIRC I >> couldn't >> do that with MatLab) > > dunno when that was, but the MATLAB remez() function (or firls()) that i > have seen for a decade has a weighting vector as an argument. >
Reply by Julien March 10, 20052005-03-10
> SBA = 80; (stop band attenuation in dB) > t = linspace(-(N-1)/4, (N-1)/4, N); > h = (0.5*sinc(t)) .* kaiser(N, 0.1102*(SBA-8.7))'; % kaiser windowed
sinc()
> clear t;
it's nice to have an exact form for Halfband filter rather than using a quite complex optimisation method. BTW i should have remembered the principles, they are in my school book => Proakis chapter 8.2.2 Design of Linear-phase FIR filter using Windows :-) thanks, Julien
Reply by Jerry Avins March 9, 20052005-03-09
robert bristow-johnson wrote:
> in article d_qdnYL5Jv1X27LfRVn-3g@rcn.net, Jerry Avins at jya@ieee.org wrote > on 03/09/2005 13:56: > > >>Have you tried to design a half-band filter using a Parks-McClellan >>program not specialized for it? The supposedly zero terms usually have >>small values, often large enough to disturb the filter's response if >>they are zeroed. Windowed-sync design is a quick fix that rarely needs >>more than an additional pair of taps to equal a constrained P-M design. > > > i haven't fiddled that much with half-band P-M (using the MATLAB remez()) > function, but i do have an implementation of it (you have to make sure that > the filter spec and weighting factors are precisely symmetrical about half > Nyquist). my experience with it the coefficients that aren't zero are so > damn close that when i do force them to zero, it apparently changes nothing. > > if you have MATLAB, Jerry, i could send this to you.
I don't have Matlab and I haven't tried it in Scilab. The program I did use wasn't ad good as you describe. 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;
Reply by robert bristow-johnson March 9, 20052005-03-09
in article 3990olF5v573eU1@individual.net, Symon at symon_brewer@hotmail.com
wrote on 03/09/2005 14:23:

> The Perl > program is useful for tampering with the weighting function, IIRC I couldn't > do that with MatLab)
dunno when that was, but the MATLAB remez() function (or firls()) that i have seen for a decade has a weighting vector as an argument. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."