DSPRelated.com
Forums

FIR filter with a flat transfer function

Started by ecco December 20, 2006
Hi, All

While I'm not too familiar with all of the real-world DSP tricks and
techniques, I do have a pretty good understanding of continuous- and
discrete-time signals and systems.  My question:

I am trying to build an FIR filter for linear prediction, i.e., the 0th
order tap in the FIR filter must be 0.  The filter needs to have a
near-flat magnitude response (1dB ripple?), and, here's the catch, the
filter should have a '0' phase response from 0Hz out to as far as
possible.

Again, what makes this tricky is that the 0th order tap must be 0.  Can
anyone point me in the direction of a tool which will allow me to try
to build a filter to these specs?  Even better, does anyone know of
such a filter?

Thanks!

ecco

ecco wrote:

> Hi, All > > While I'm not too familiar with all of the real-world DSP tricks and > techniques, I do have a pretty good understanding of continuous- and > discrete-time signals and systems. My question: > > I am trying to build an FIR filter for linear prediction, i.e., the 0th > order tap in the FIR filter must be 0. The filter needs to have a > near-flat magnitude response (1dB ripple?), and, here's the catch, the > filter should have a '0' phase response from 0Hz out to as far as > possible. > > Again, what makes this tricky is that the 0th order tap must be 0. Can > anyone point me in the direction of a tool which will allow me to try > to build a filter to these specs? Even better, does anyone know of > such a filter? > > Thanks! > > ecco >
[0 1 0] Of course that is just a delay, but it has no passband ripple and 0 phase for all frequencies (up to fs/2) and the 0th order tap is 0.
Ray Andraka wrote:

> ecco wrote: > >> Hi, All >> >> While I'm not too familiar with all of the real-world DSP tricks and >> techniques, I do have a pretty good understanding of continuous- and >> discrete-time signals and systems. My question: >> >> I am trying to build an FIR filter for linear prediction, i.e., the 0th >> order tap in the FIR filter must be 0. The filter needs to have a >> near-flat magnitude response (1dB ripple?), and, here's the catch, the >> filter should have a '0' phase response from 0Hz out to as far as >> possible. >> >> Again, what makes this tricky is that the 0th order tap must be 0. Can >> anyone point me in the direction of a tool which will allow me to try >> to build a filter to these specs? Even better, does anyone know of >> such a filter? >> >> Thanks! >> >> ecco >> > [0 1 0] > Of course that is just a delay, but it has no passband ripple and 0 > phase for all frequencies (up to fs/2) and the 0th order tap is 0.
Oops, my bad. This has a linear phase response, not a zero response.
ecco wrote:
> Hi, All > > While I'm not too familiar with all of the real-world DSP tricks and > techniques, I do have a pretty good understanding of continuous- and > discrete-time signals and systems. My question: > > I am trying to build an FIR filter for linear prediction, i.e., the 0th > order tap in the FIR filter must be 0. The filter needs to have a > near-flat magnitude response (1dB ripple?), and, here's the catch, the > filter should have a '0' phase response from 0Hz out to as far as > possible. > > Again, what makes this tricky is that the 0th order tap must be 0. Can > anyone point me in the direction of a tool which will allow me to try > to build a filter to these specs? Even better, does anyone know of > such a filter?
You say you have a good undersntanding of signals and systems (including discrete-time). Shouldn't it be obvious for you that what you're asking for is physically impossible?? Zero-phase *requires* a symmetric impulse response --- a symmetric impulse response is either the "identity" filter (a wire connecting input to output), or it is non-causal. I guess your next step should be letting us know what you are trying to achieve --- someone in here might have good ideas/tips to help you with that. HTH, Carlos --

ecco wrote:

> I am trying to build an FIR filter for linear prediction, i.e., the 0th > order tap in the FIR filter must be 0. The filter needs to have a > near-flat magnitude response (1dB ripple?), and, here's the catch, the > filter should have a '0' phase response from 0Hz out to as far as > possible.
A linear predictor is usually computed from the data - ie. you don't get to specify phase or magnitude response, it just turns out the way it does by minimizing the prediction error. Yet in other words, a near-flat magnitude and linear-phase FIR filter might be a great filter, but will in general be a lousy predictor. Your system seems overspecified. Regards, Andor
Ray Andraka wrote:
> Ray Andraka wrote: > >> ecco wrote: >> >>> Hi, All >>> >>> While I'm not too familiar with all of the real-world DSP tricks and >>> techniques, I do have a pretty good understanding of continuous- and >>> discrete-time signals and systems. My question: >>> >>> I am trying to build an FIR filter for linear prediction, i.e., the 0th >>> order tap in the FIR filter must be 0. The filter needs to have a >>> near-flat magnitude response (1dB ripple?), and, here's the catch, the >>> filter should have a '0' phase response from 0Hz out to as far as >>> possible. >>> >>> Again, what makes this tricky is that the 0th order tap must be 0. Can >>> anyone point me in the direction of a tool which will allow me to try >>> to build a filter to these specs? Even better, does anyone know of >>> such a filter? >>> >>> Thanks! >>> >>> ecco >>> >> [0 1 0] >> Of course that is just a delay, but it has no passband ripple and 0 >> phase for all frequencies (up to fs/2) and the 0th order tap is 0. > > > Oops, my bad. This has a linear phase response, not a zero response.
If the first tap is zero and there is any response at all, there must be some delay. Delay and true zero phase can't be had together. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Thanks for the corrective ping, Carlos.  Yes, I understand that a
perfectly flat magnitude response is impossible and that a zero phase
response across the entire band is also impossible (given that the 0th
order tap is zero).  Please allow me to phrase my question a bit more
accurately:

I would like an FIR filter with a ~1dB ripple magnitude response and a
phase response which is within 10% of 0 out to as far as possible.  In
short, I'm trying to make a filter which does as little as possible to
the signal, but whose 0th order tap is 0.

As I stated, I don't know much about the tools-of-the-DSP-trade.  While
I can find FIR tools which let me design linear-phase filters
(symmetric taps), I can't find anything that lets me set one of the
taps (the 0th order tap) and design around it.  Moreover, I thought
that there might be some well-known FIR constructs which already
address this design problem.

Thanks for any help.

ec


Carlos Moreno wrote:
> ecco wrote: > > Hi, All > > > > While I'm not too familiar with all of the real-world DSP tricks and > > techniques, I do have a pretty good understanding of continuous- and > > discrete-time signals and systems. My question: > > > > I am trying to build an FIR filter for linear prediction, i.e., the 0th > > order tap in the FIR filter must be 0. The filter needs to have a > > near-flat magnitude response (1dB ripple?), and, here's the catch, the > > filter should have a '0' phase response from 0Hz out to as far as > > possible. > > > > Again, what makes this tricky is that the 0th order tap must be 0. Can > > anyone point me in the direction of a tool which will allow me to try > > to build a filter to these specs? Even better, does anyone know of > > such a filter? > > You say you have a good undersntanding of signals and systems (including > discrete-time). Shouldn't it be obvious for you that what you're asking > for is physically impossible?? > > Zero-phase *requires* a symmetric impulse response --- a symmetric > impulse response is either the "identity" filter (a wire connecting > input to output), or it is non-causal. > > I guess your next step should be letting us know what you are trying > to achieve --- someone in here might have good ideas/tips to help you > with that. > > HTH, > > Carlos > --
Andor wrote:
> > ecco wrote: > >> I am trying to build an FIR filter for linear prediction, i.e., the 0th >> order tap in the FIR filter must be 0. The filter needs to have a >> near-flat magnitude response (1dB ripple?), and, here's the catch, the >> filter should have a '0' phase response from 0Hz out to as far as >> possible. > > A linear predictor is usually computed from the data - ie. you don't > get to specify phase or magnitude response, it just turns out the way > it does by minimizing the prediction error. > > Yet in other words, a near-flat magnitude and linear-phase FIR filter > might be a great filter, but will in general be a lousy predictor. Your > system seems overspecified.
Moreover, with the first tap set to zero, the filter can't incorporate the newest data into its output. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
ecco wrote:
> Thanks for the corrective ping, Carlos. Yes, I understand that a > perfectly flat magnitude response is impossible and that a zero phase > response across the entire band is also impossible (given that the 0th > order tap is zero). Please allow me to phrase my question a bit more > accurately: > > I would like an FIR filter with a ~1dB ripple magnitude response and a > phase response which is within 10% of 0 out to as far as possible. In > short, I'm trying to make a filter which does as little as possible to > the signal, but whose 0th order tap is 0. >
ecco, I don't think you're quite specifying your filter requirements clear enough - at least, not clear enough to get the answer you're looking for. After reading your initial post, i thought you wanted a filter with a constant amplitude response but which gives a phase of zero at it's output, which of course means some form of phase cancellation, i think this is what Ray Andraka thought as well, hence his initial post and then retraction. However, reading your latest clarification post quoted above, then i am more inclined to go back to Ray's initial post of h=[0, 1, 0] as this will do as little as possible to the signal. Perhaps you could clarify with an example? Give us an input and specify a desired ouput. col
ecco wrote:
> Thanks for the corrective ping, Carlos. Yes, I understand that a > perfectly flat magnitude response is impossible and that a zero phase > response across the entire band is also impossible (given that the 0th > order tap is zero). Please allow me to phrase my question a bit more > accurately: > > I would like an FIR filter with a ~1dB ripple magnitude response and a > phase response which is within 10% of 0 out to as far as possible. In > short, I'm trying to make a filter which does as little as possible to > the signal, but whose 0th order tap is 0. > > As I stated, I don't know much about the tools-of-the-DSP-trade. While > I can find FIR tools which let me design linear-phase filters > (symmetric taps), I can't find anything that lets me set one of the > taps (the 0th order tap) and design around it. Moreover, I thought > that there might be some well-known FIR constructs which already > address this design problem.
What do you want the filter to accomplish? What does 10% phase (or 10% of zero) mean? A filter whose two taps are [0 1] has a one-sample-time delay, or 180 degrees at the uppermost frequency. Adding taps can only increase the phase. I don't know what picture you have in mind, but you need to work out the details out more clearly. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯