Forums

Interpolation using polyphase FIR filter: Finding coeffisients

Started by MrAlfred September 28, 2007
Ron N wrote:
>The problem is that filter coefficients *can* be found from this >information, an infinite number of sets of coefficients, including >just 1.0 (duplicate the nearest sample). If 1.0 isn't good enough, >why not? If 1.0 isn't good enough, then you must have some >unstated lower bound on interpolation accuracy.
I thought duplicating the nearest sample would give unwanted repeating specters?? If not, 1.0 is probably what I want.
>For some metrics, the "quality" of a filter will increase with the >number of coefficients, without bound. Where do you stop if >you don't want to filter infinitely? If you don't want an infinite >FIR computation, then you must have some unstated upper >bound of quality of interpolation. Some number of bits of >precision or something.
I really don't know the answer to this one. I want the signal to be "the same as before interpolating" and with no repeating specters. If 1.0 isn't good enough, what about 10 or 20 sets of coeffisients? Would i.e 30 sets of coeffisients work fine for most applications, or does it not work that way?
On Wed, 03 Oct 2007 09:50:25 -0500, "MrAlfred" <jonneset@online.no>
wrote:

>Thank you all for your replies! I have to stress that I have no experience >with digital signal processing at all, I am a complete novice in this >field. I have only used linear interpolation before, so please bear with >me even if you'll find my questions stupid :) > >Mnentwig wrote: >>Filter specs, shooting from the hip: >>Passband ripple < 0.1 dB >>Stopband (alias band) attenuation: > 60 dB >>OF COURSE this depends on YOUR requirements. > >My problem is that I really don't know what my requirements are. I know >that I have a signal, and that I want it to be interpolated, but I don't >know the requirements in terms of filter specs or what passband and >stopband really means. What I know: > >-Datastream output now sampled at 4800 times pr second >-Have to be interpolated to 250000 samples pr second without repeating >specters > >Can the coeffisients be found with just this information? In other words, >can the filter specs be calculated out of this information? If not, what >more do I need to know? >
(snipped)
>Regards, >Jon >Trondheim, Norway
Hello Jon, You have a very computationally tough problem! Your interpolation factor is: 250000/4800 = 625/12 . So you must interpolate your signal by 625, and then decimate that "interpolated" signal by 12. Whew!!! Interpolation by 625 requires a lowpass filter having a passband width so narrow that I don't want to even contemplate how I'd implement such a filter. I haven't studied such an idea, but perhaps you could interpolate by a factor of 5 four times in succession. Doing that, I assume, would require far fewer filter computations than interpolating once by 625. Now, if I'm not mistaken, interpolation by 5 requires a lowpass filter whose passband is roughly 0.1 times the "upsampled by 5" sample rate. Now, the number of coefficients in such a filter will affect the accuracy of your interpolation (i.e., the attenuation of the unwanted spectral images caused by the upsampling by 5). The more coefficients in the filter, the more accurate the interpolation. Designing such a lowpass filter is not too complicated. (There are probably 500 guys in this newsgroup who could help you design that filter.) If that "interpolate by a factor of 5 four times in succession" notion works, then you could end your entire process with a decimate by 12 operation. Jon, digital resampling is not the most complicated subject in the world (compared to, say, the U.S. Income Tax Code), but it's definitely not terribly simple either. You should start learning about the filtering required in resampling applications, and to do that you need to have a fairly solid understanding of digital filters. In any case, those are my "two cents." You have an **INTERESTING** problem! Keep asking questions here, OK? Good Luck, [-Rick-]
On Oct 4, 2:04 am, "MrAlfred" <jonne...@online.no> wrote:
> Ron N wrote: > >The problem is that filter coefficients *can* be found from this > >information, an infinite number of sets of coefficients, including > >just 1.0 (duplicate the nearest sample). If 1.0 isn't good enough, > >why not? If 1.0 isn't good enough, then you must have some > >unstated lower bound on interpolation accuracy. > > I thought duplicating the nearest sample would give unwanted repeating > specters?? If not, 1.0 is probably what I want.
Yes, duplicating samples will create spectral aliasing.
> >For some metrics, the "quality" of a filter will increase with the > >number of coefficients, without bound. Where do you stop if > >you don't want to filter infinitely? If you don't want an infinite > >FIR computation, then you must have some unstated upper > >bound of quality of interpolation. Some number of bits of > >precision or something. > > I really don't know the answer to this one. I want the signal to be "the > same as before interpolating" and with no repeating specters. If 1.0 isn't > good enough, what about 10 or 20 sets of coeffisients? Would i.e 30 sets of > coeffisients work fine for most applications, or does it not work that way?
The problem is that any finite length FIR will also leave spectral aliases; just smaller amounts as the FIR length increases and the coefficients improve. The number of sets depends on the requirements of your application, as every application may have a different requirement for how small the spectral images have to become before one can safely ignore them (for instance if they are smaller than some quantization error, the thermal noise in the original signal, or the amount needed to demodulate some data in the signal, etc.) IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Ron N. wrote:

   ...

> The problem is that any finite length FIR will also leave > spectral aliases; just smaller amounts as the FIR length > increases and the coefficients improve. The number of sets > depends on the requirements of your application, as every > application may have a different requirement for how small the > spectral images have to become before one can safely ignore > them (for instance if they are smaller than some quantization > error, the thermal noise in the original signal, or the amount > needed to demodulate some data in the signal, etc.)
That's exactly analogous to my having been asked to drill a hole "dead center" in the bottom of a machined aluminum cup. I asked what tolerance was allowed and got a blank stare and a one-word response: "Tolerance?" When I translated that to allowed error, the answer was simple: "It has to be exact. No error at all". I declared incompetence, saying that I could measure a tenth of a mil, but only work to about three times that. Besides, if the cup was machined last week, it didn't have an exact center any more. El Exigente asked how big a mil is, and I told him about a third the thickness of a piece of writing paper. He was astonished: "I can't even see that small!" My three-jaw chuck and a twist drill did nicely. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
On Thu, 04 Oct 2007 15:05:46 GMT, R.Lyons@_BOGUS_ieee.org (Rick Lyons)
wrote:

  (snipped)

Hi,
   I just thought of something.
If you "interpolate by a factor of 5 four times 
in succession", the number of taps in the filter
used in the 2nd interpolation step will be fewer 
than the number of taps in the filter
used in the 1st interpolation step.

And the number of filter taps used in the 3rd 
interpolation step will be fewer 
than the number of filter taps used in the 2nd 
interpolation step, and so on.  That's good news for 
you Jon.

See Ya',
[-Rick-]

mnentwig wrote:
> To come back to the question, a possible signal chain _could_ look as > follows: > > input at rate 1 > upsampling filter by 2 => rate 2 > upsampling filter by 2 => rate 4 > upsampling filter by 2 => rate 8 > upsampling filter by 2 => rate 16 > upsampling filter by 2 => rate 32 > Farrows from rate 32 to 52.08
From an efficiency standpoint, I would suggest moving the arbitrary ratio resampling (ARR -- not necessarily Farrow) a bit earlier in the chain, but not all the way to the beginning. In a cost-per-output-sample shootout, the upsample by 2 will beat the pants off the ARR. But the ARR is better/faster if it is fed oversampled data. Which leads me to suggest a sweet spot of using ARR with data that is oversampled about 2x or 4x. Use halfband filters for the upsample-by-2 stages, only compute the midpoint samples. The original points will stay unchanged. At each up-by-2 stage the transition bandwidth gets wider, allowing for shorter filters, which helps offset the increasing rate. Example: You can interpolate a 4x oversampled signal to 8x oversampled with 90dB OOB rejection using a symmetric fir having only 3 multiplies. And that only needs to be applied to every other output sample. Or you can get 60dB rejection with only two multiplies. fc=1/8; b=remez( 12, [0 fc 1-fc 1],[1 1 0 0]); freqz(b) -- Mark
robert bristow-johnson wrote:

> > I would start with Parks McClellan (aka equiripple), but keep an eye on > > those outermost samples of the impulse response. They are not on a smooth > > curve with the others. > > if the OP is using MATLAB with the sig proc toolbox, i might suggest > firls(.) as an alternative to P-McC.
An alternative to firls() for users without the SP Toolbox is Greg Berchin's excellent FDLS filter desing method: http://apollo.ee.columbia.edu/spm/external/tipsandtricks/files/TandT_Jan2007.zip
> there are some other tricks.
The one about randomizing the error in the P-M algorithm, for example. Is there a write-up or some code out there? Regards, Andor
> Mark wrote: >From an efficiency standpoint, I would suggest moving the arbitrary >ratio resampling (ARR -- not necessarily Farrow) a bit earlier in the >chain, but not all the way to the beginning. > >In a cost-per-output-sample shootout, the upsample by 2 will beat the >pants off the ARR. But the ARR is better/faster if it is fed >oversampled data. Which leads me to suggest a sweet spot of using ARR >with data that is oversampled about 2x or 4x. > > >Use halfband filters for the upsample-by-2 stages, only compute the >midpoint samples. The original points will stay unchanged. > >At each up-by-2 stage the transition bandwidth gets wider, allowing for >shorter filters, which helps offset the increasing rate.
Yes, that sounds very reasonable. Cheers Markus
Hi Jon,
Look at chapter 16 of my free on-line book at www.DSPguide.com. It will
tell you how to find the coefficients of the FIR filter with the
information you have. 
Regards,
Steve Smith