DSPRelated.com
Forums

band-pass FIR filter low stopband attenuation problem

Started by Michel Rouzic October 3, 2005
I have designed a band-pass filter that uses two windowed-sinc
functions that has one which is spectral inverted, and the two are
convolved together.

The problem with that, is the stopband attenuation on the low side is
very poor. It's all well above -50db, as on the high side, it's mostly
all under -60db.

Both my windowed-sinc functions look fine when looking at their
frequency response, so I don't understand how i can get to such a poor
stopband attenuation, on only one side.

Does it mean I did something wrong (although I can't see what, that
whole thing is made very simply by calling functions that I've tested
pretty much) or that I should rather design a band-reject FIR and
spectral-invert it?

Michel Rouzic wrote:
> I have designed a band-pass filter that uses two windowed-sinc > functions that has one which is spectral inverted, and the two are > convolved together. > > The problem with that, is the stopband attenuation on the low side is > very poor. It's all well above -50db, as on the high side, it's mostly > all under -60db. > > Both my windowed-sinc functions look fine when looking at their > frequency response, so I don't understand how i can get to such a poor > stopband attenuation, on only one side. > > Does it mean I did something wrong (although I can't see what, that > whole thing is made very simply by calling functions that I've tested > pretty much) or that I should rather design a band-reject FIR and > spectral-invert it?
This is what I would try: Define the pass band as [f1,f2] and BW = f2-f1. Define also fc = (f1 + f2)/2 (make a sketch on paper to see the details). Design a low-pass filter with cut-off requency BW/2 and modulate the response (i.e multiply with a cosine) with frequency fc. Rune
Rune Allnor wrote:
> Michel Rouzic wrote: > > I have designed a band-pass filter that uses two windowed-sinc > > functions that has one which is spectral inverted, and the two are > > convolved together. > > > > The problem with that, is the stopband attenuation on the low side is > > very poor. It's all well above -50db, as on the high side, it's mostly > > all under -60db. > > > > Both my windowed-sinc functions look fine when looking at their > > frequency response, so I don't understand how i can get to such a poor > > stopband attenuation, on only one side. > > > > Does it mean I did something wrong (although I can't see what, that > > whole thing is made very simply by calling functions that I've tested > > pretty much) or that I should rather design a band-reject FIR and > > spectral-invert it? > > This is what I would try: > > Define the pass band as [f1,f2] and BW = f2-f1. Define also > fc = (f1 + f2)/2 (make a sketch on paper to see the details). > > Design a low-pass filter with cut-off requency BW/2 and modulate > the response (i.e multiply with a cosine) with frequency fc. > > Rune
ok, took me a few minutes and a few sketches to figure out what it would do. Sounds like a good way to do it, even if the rolloff bandwidthes be the same on both sides. btw I guess that if you tell me to try that, you must think that my stopband attenuation problem is normal with the technique that i'm employing right? as for the multiplying with a cosine part, should I just multiply my filter with the cosine or is there any more efficient way?
Michel Rouzic wrote:
> Rune Allnor wrote: > > Michel Rouzic wrote: > > > I have designed a band-pass filter that uses two windowed-sinc > > > functions that has one which is spectral inverted, and the two are > > > convolved together. > > > > > > The problem with that, is the stopband attenuation on the low side is > > > very poor. It's all well above -50db, as on the high side, it's mostly > > > all under -60db. > > > > > > Both my windowed-sinc functions look fine when looking at their > > > frequency response, so I don't understand how i can get to such a poor > > > stopband attenuation, on only one side. > > > > > > Does it mean I did something wrong (although I can't see what, that > > > whole thing is made very simply by calling functions that I've tested > > > pretty much) or that I should rather design a band-reject FIR and > > > spectral-invert it? > > > > This is what I would try: > > > > Define the pass band as [f1,f2] and BW = f2-f1. Define also > > fc = (f1 + f2)/2 (make a sketch on paper to see the details). > > > > Design a low-pass filter with cut-off requency BW/2 and modulate > > the response (i.e multiply with a cosine) with frequency fc. > > > > Rune > > ok, took me a few minutes and a few sketches to figure out what it > would do. Sounds like a good way to do it, even if the rolloff > bandwidthes be the same on both sides.
Well, "a good way to do things" might be an exaggergation. You are restricted with respect to roll-off on both sides, and there may be problems with aliasing in the lower stop-band.
> btw I guess that if you tell me to try that, you must think that my > stopband attenuation problem is normal with the technique that i'm > employing right?
I am not surprised that there are problems. Window-based designs don't leave much control over stop-band attenuation, and aliasing ought to be a problem.
> as for the multiplying with a cosine part, should I just multiply my > filter with the cosine or is there any more efficient way?
I think the cosine multiplcation is the way to go, if you decide to stick with the window designs. If this turns out to be a serious problem, you might want to switch to the Parks-McClellan method. Rune
"Michel Rouzic" <Michel0528@yahoo.fr> wrote in message 
news:1128354509.740974.131570@g43g2000cwa.googlegroups.com...
>I have designed a band-pass filter that uses two windowed-sinc > functions that has one which is spectral inverted, and the two are > convolved together. > > The problem with that, is the stopband attenuation on the low side is > very poor. It's all well above -50db, as on the high side, it's mostly > all under -60db. > > Both my windowed-sinc functions look fine when looking at their > frequency response, so I don't understand how i can get to such a poor > stopband attenuation, on only one side.
Michael, It would really help if your description were more precise. It leaves a lot to the imagination - and *that* is dangerous. In particular it appears that the convolution you mention is in time but what if it isn't?? The convolution should be in time. Multiply in frequency IF I understand what you're doing. Make sure you leave room for the time domain convolution - that is that the two windowed sincs are adeqately zero-padded. Otherwise you will get temporal aliasing and unexpected results ... no matter if you convolve in time or multiply in frequency .. same thing. I've never heard of inverting the spectrum in order to design a filter. Maybe I have something to learn.... It conjures up the vision of zeros becoming infinite values..... Why not use the windowing method or Parks-McClellan? The windowing method would start with the ideal filter and convolve in frequency with a windowed sinc or Dirichlet kernel really. If the filter is too short / the sinc is too broad and if the stopband around zero frequency is too narrow then you'll get what you describe. I hope this helps. Fred
Fred Marshall wrote:
> "Michel Rouzic" <Michel0528@yahoo.fr> wrote in message > news:1128354509.740974.131570@g43g2000cwa.googlegroups.com... > >I have designed a band-pass filter that uses two windowed-sinc > > functions that has one which is spectral inverted, and the two are > > convolved together. > > > > The problem with that, is the stopband attenuation on the low side is > > very poor. It's all well above -50db, as on the high side, it's mostly > > all under -60db. > > > > Both my windowed-sinc functions look fine when looking at their > > frequency response, so I don't understand how i can get to such a poor > > stopband attenuation, on only one side. > > Michael, > > It would really help if your description were more precise. It leaves a lot > to the imagination - and *that* is dangerous. In particular it appears that > the convolution you mention is in time but what if it isn't?? The > convolution should be in time. Multiply in frequency IF I understand what > you're doing. > Make sure you leave room for the time domain convolution - that is that the > two windowed sincs are adeqately zero-padded. Otherwise you will get > temporal aliasing and unexpected results ... no matter if you convolve in > time or multiply in frequency .. same thing. > > I've never heard of inverting the spectrum in order to design a filter. > Maybe I have something to learn.... It conjures up the vision of zeros > becoming infinite values.....
"inverting the spectrum" consists in switching the signs of all your samples and then adding 1 to the central sample. thus in the frequency response, 0's becomes 1's and 1's become 0's.
> Why not use the windowing method or Parks-McClellan?
Because I never heard of it before
> The windowing method would start with the ideal filter and convolve in > frequency with a windowed sinc or Dirichlet kernel really. If the filter is > too short / the sinc is too broad and if the stopband around zero frequency > is too narrow then you'll get what you describe. > > I hope this helps. > > Fred
I'm not sure to see what it consists of, but as for my problem, well, anyways looks fine, as for the frequency response, it's just that when you look in details, you realize that on the low side things are "higher" than you'd like them to be. I made sure that both my FIR's frequency response is right and that my convolution function (FFT convolution with overlap-add) works very good, i can tell because the frequency response of any signal convolved with any windowed-sinc function I do (even spectrally-inverted ones) is exactly what expected, so I don't think I have any problem of aliasing.
Rune Allnor wrote:
> Michel Rouzic wrote: > > Rune Allnor wrote: > > > Michel Rouzic wrote: > > > > I have designed a band-pass filter that uses two windowed-sinc > > > > functions that has one which is spectral inverted, and the two are > > > > convolved together. > > > > > > > > The problem with that, is the stopband attenuation on the low side is > > > > very poor. It's all well above -50db, as on the high side, it's mostly > > > > all under -60db. > > > > > > > > Both my windowed-sinc functions look fine when looking at their > > > > frequency response, so I don't understand how i can get to such a poor > > > > stopband attenuation, on only one side. > > > > > > > > Does it mean I did something wrong (although I can't see what, that > > > > whole thing is made very simply by calling functions that I've tested > > > > pretty much) or that I should rather design a band-reject FIR and > > > > spectral-invert it? > > > > > > This is what I would try: > > > > > > Define the pass band as [f1,f2] and BW = f2-f1. Define also > > > fc = (f1 + f2)/2 (make a sketch on paper to see the details). > > > > > > Design a low-pass filter with cut-off requency BW/2 and modulate > > > the response (i.e multiply with a cosine) with frequency fc. > > > > > > Rune > > > > ok, took me a few minutes and a few sketches to figure out what it > > would do. Sounds like a good way to do it, even if the rolloff > > bandwidthes be the same on both sides. > > Well, "a good way to do things" might be an exaggergation. > You are restricted with respect to roll-off on both sides, > and there may be problems with aliasing in the lower stop-band.
Maybe I've got a clue... I tried convolving the high-pass FIR with itself to have a better stopband attenuation, and then convolving it with the low-pass filter, and well the result is not at all what's expected... Actually I can try converting any filter kernel with itself it'll give the same kind of weird result... that's weird cuz I thought both my windowed-sinc generating function and my fft convoltuon worked.. I guess I have to suspect my convolution function of not working properly.... again. and this time I have no idea on how to find out whats wrong with it..
Fred Marshall wrote:
> "Michel Rouzic" <Michel0528@yahoo.fr> wrote in message > news:1128354509.740974.131570@g43g2000cwa.googlegroups.com... > >I have designed a band-pass filter that uses two windowed-sinc > > functions that has one which is spectral inverted, and the two are > > convolved together. > > > > The problem with that, is the stopband attenuation on the low side is > > very poor. It's all well above -50db, as on the high side, it's mostly > > all under -60db. > > > > Both my windowed-sinc functions look fine when looking at their > > frequency response, so I don't understand how i can get to such a poor > > stopband attenuation, on only one side. > > Michael, > > It would really help if your description were more precise. It leaves a lot > to the imagination - and *that* is dangerous. In particular it appears that > the convolution you mention is in time but what if it isn't?? The > convolution should be in time. Multiply in frequency IF I understand what > you're doing. > Make sure you leave room for the time domain convolution - that is that the > two windowed sincs are adeqately zero-padded. Otherwise you will get > temporal aliasing and unexpected results ... no matter if you convolve in > time or multiply in frequency .. same thing. > > I've never heard of inverting the spectrum in order to design a filter. > Maybe I have something to learn.... It conjures up the vision of zeros > becoming infinite values.....
"inverting the spectrum" consists in switching the signs of all your samples and then adding 1 to the central sample. thus in the frequency response, 0's becomes 1's and 1's become 0's.
> Why not use the windowing method or Parks-McClellan?
Because I never heard of it before
> The windowing method would start with the ideal filter and convolve in > frequency with a windowed sinc or Dirichlet kernel really. If the filter is > too short / the sinc is too broad and if the stopband around zero frequency > is too narrow then you'll get what you describe. > > I hope this helps. > > Fred
I'm not sure to see what it consists of, but as for my problem, well, anyways looks fine, as for the frequency response, it's just that when you look in details, you realize that on the low side things are "higher" than you'd like them to be. I made sure that both my FIR's frequency response is right and that my convolution function (FFT convolution with overlap-add) works very good, i can tell because the frequency response of any signal convolved with any windowed-sinc function I do (even spectrally-inverted ones) is exactly what expected, so I don't think I have any problem of aliasing.
Michel Rouzic wrote:
> Fred Marshall wrote:
...
>>Why not use the windowing method or Parks-McClellan? > > > Because I never heard of it before
For an example download ScopeFIR from http://www.iowegian.com/. ... 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;
"Michel Rouzic" <Michel0528@yahoo.fr> wrote in message 
news:1128370779.550204.20720@o13g2000cwo.googlegroups.com...
> > Fred Marshall wrote: >> "Michel Rouzic" <Michel0528@yahoo.fr> wrote in message >> news:1128354509.740974.131570@g43g2000cwa.googlegroups.com... >> >I have designed a band-pass filter that uses two windowed-sinc >> > functions that has one which is spectral inverted, and the two are >> > convolved together. >> > >> > The problem with that, is the stopband attenuation on the low side is >> > very poor. It's all well above -50db, as on the high side, it's mostly >> > all under -60db. >> > >> > Both my windowed-sinc functions look fine when looking at their >> > frequency response, so I don't understand how i can get to such a poor >> > stopband attenuation, on only one side. >> >> Michael, >> >> It would really help if your description were more precise. It leaves a >> lot >> to the imagination - and *that* is dangerous. In particular it appears >> that >> the convolution you mention is in time but what if it isn't?? The >> convolution should be in time. Multiply in frequency IF I understand >> what >> you're doing. >> Make sure you leave room for the time domain convolution - that is that >> the >> two windowed sincs are adeqately zero-padded. Otherwise you will get >> temporal aliasing and unexpected results ... no matter if you convolve in >> time or multiply in frequency .. same thing. >> >> I've never heard of inverting the spectrum in order to design a filter. >> Maybe I have something to learn.... It conjures up the vision of zeros >> becoming infinite values..... > > "inverting the spectrum" consists in switching the signs of all your > samples and then adding 1 to the central sample. thus in the frequency > response, 0's becomes 1's and 1's become 0's. > >> Why not use the windowing method or Parks-McClellan? > > Because I never heard of it before
Parks-McClellan executable for a PC at: ftp.mission-systems-inc.com/outgoing/Parks_McClellan/ParksMcClellan.exe OK, I will paraphrase the description for inverting the spectrum: 1) We assume that the passband gain is 1.0 across all passbands. 2) We assume that the stopband gain objective at least is 0 for all stopbands. 3) We assume that the frequency response is purely real (because of the next steps it will be necessary) this means the filter unit sample response must be an even function of time - i.e. symmetric. 4) We change the sign of the frequency response so that all of the passbands are now -1.0 and the stopbands are still near zero. 5) We add 1.0 to all the samples of the result (here is where the filter frequency response must be real because we're adding real 1.0. If the frequency response were complex then adding real 1.0 could change the magnitude response away from 1.0). The result is a frequency domain function that has passbands and stopbands switched from the original prototype. Oh! That's a little different that what you described I believe. I think you inverted the signs of the temporal unit sample response. And that does invert the frequency response so you might as well have done it in frequency, no? Also, you have to be careful about which term in the time response to add 1.0 to ... but it appears to work. A new trick for me! Fred