hi, I wonder how you guys would proceed to solve the following (probably rather standard) problem: - given a system that has an average sample rate of approx 200 Hz - a space-time signal needs to be smoothed, i.e. find x_hat[k] given x[k], y_hat[k] given y[k] where x_hat, y_hat are the estimates of the unknown truth - noise is present in the signal. the noise seems to be additive and follow a normal distribution with 0 mean and a variance that is not constant but which, in average is constant and rather small compared to average step size and magnitude of the signal of interest - afaik, usually this problem is known as a stochastic filtering or smoothing problem. here however the noise is pretty well known, but the underlying signal cannot be modelled easily: curvilinear motion model may hold, however, its parameters are totally random and time-varying. the problem solving constraints are the following: - it's a real time problem, no decimation is allowed - filter as much of the noise as possible, but no specific design goal - no overshoot - pass band must have unity gain, no error tolerance - maximum group delay in pass band shall not exceed 4 samples - implementation complexity does not matter, FPU is available if necessary my approach was the following: - given the nature of the problem it'll be hard/impossible to use a stochastic filter like Kalman filter, because the process model is not known - therefore, simple low-pass filtering is my choice: however, which filter? - 1st order IIR LPF, e.g. the exponential smoother? - simple averager on 8 samples? - Gaussian FIR LPF on 8 samples? anything better? thanks for all your advices and tips... Andy _____________________________ Posted through www.DSPRelated.com
how to filter this optimally?
Started by ●March 26, 2014
Reply by ●March 26, 20142014-03-26
On Wed, 26 Mar 2014 05:42:52 -0500, ombz wrote:> hi, > > I wonder how you guys would proceed to solve the following (probably > rather standard) problem: > > - given a system that has an average sample rate of approx 200 Hz - a > space-time signal needs to be smoothed, i.e. find x_hat[k] given x[k], > y_hat[k] given y[k] where x_hat, y_hat are the estimates of the unknown > truth - noise is present in the signal. the noise seems to be additive > and follow a normal distribution with 0 mean and a variance that is not > constant but which, in average is constant and rather small compared to > average step size and magnitude of the signal of interest - afaik, > usually this problem is known as a stochastic filtering or smoothing > problem. here however the noise is pretty well known, but the underlying > signal cannot be modelled easily: curvilinear motion model may hold, > however, its parameters are totally random and time-varying. > > the problem solving constraints are the following: > - it's a real time problem, no decimation is allowed - filter as much of > the noise as possible, but no specific design goal - no overshoot - pass > band must have unity gain, no error tolerance - maximum group delay in > pass band shall not exceed 4 samples - implementation complexity does > not matter, FPU is available if necessary > > my approach was the following: > - given the nature of the problem it'll be hard/impossible to use a > stochastic filter like Kalman filter, because the process model is not > known - therefore, simple low-pass filtering is my choice: however, > which filter? > - 1st order IIR LPF, e.g. the exponential smoother? > - simple averager on 8 samples? > - Gaussian FIR LPF on 8 samples?If you frame your problem right, the Kalman filter that you get will be a first order IIR LPF with a varying pole that tends toward a constant. If delay is an issue then your best bet is an IIR filter, probably a first or second order. Given your "no overshoot" requirement, that's pointing to a first-order. If you do use a second-order, then start with a continuous-time Bessel prototype and design from there. I think I'd just see what I could do with a 1st-order or 2nd-order Bessel that meets your group delay requirement, then decide if I wanted to tell my boss that I'm a hero, or quietly brush up my resume. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●March 26, 20142014-03-26
Hi, what I'd do is use a very long FIR filter but enforce a group delay of four samples in the numeric optimization. It's almost an IIR filter but it has more design parameters than a conventional implementation with feedback. You can't meet all the requirements so specifying the best trade-off becomes the main problem. The numerical optimization itself is usually robust for a few dozen parameters. For more taps, use an analog filter / IIR impulse response of your choice as initial value. _____________________________ Posted through www.DSPRelated.com
Reply by ●March 26, 20142014-03-26
mnentwig <24789@dsprelated> wrote: (previously snipped question)> what I'd do is use a very long FIR filter but enforce a group delay of four > samples in the numeric optimization. It's almost an IIR filter but it has > more design parameters than a conventional implementation with feedback. > You can't meet all the requirements so specifying the best trade-off > becomes the main problem. The numerical optimization itself is usually > robust for a few dozen parameters. For more taps, use an analog filter / > IIR impulse response of your choice as initial value.The four sample group delay seems a little restrictive. For either the long FIR or IIR, you will have to allow any transients to die out. The OP didn't mention restrictions on that. -- glen
Reply by ●March 27, 20142014-03-27
On 3/26/14 8:27 PM, glen herrmannsfeldt wrote:> mnentwig<24789@dsprelated> wrote: > > (previously snipped question) > >> what I'd do is use a very long FIR filter but enforce a group delay of four >> samples in the numeric optimization.curious what the FIR, h[n], is for n >> 8 ?>> It's almost an IIR filter but it has >> more design parameters than a conventional implementation with feedback. >> You can't meet all the requirements so specifying the best trade-off >> becomes the main problem. The numerical optimization itself is usually >> robust for a few dozen parameters. For more taps, use an analog filter / >> IIR impulse response of your choice as initial value. > > The four sample group delay seems a little restrictive. >it is. it means anything beyond the 9th tap (or "8th" if you count the "0th" tap) contributes to a group delay greater than 4 samples.> For either the long FIR or IIR, you will have to allow any transients > to die out. The OP didn't mention restrictions on that.but doesn't the physics (or maths)? how much energy do you dare put into h[n] after n=8? (i know we can sorta PWM a low frequency component, but i think we have to "enforce a group delay of four samples" on a restricted range of frequencies.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●March 28, 20142014-03-28
Dear all, Thanks for your answers and hints! So it's definitely either a 1st order IIR or an 8-tap FIR, as I thought. Not sure about that more-than-8-tap FIR. Of course when you simply add very weak taps you don't really add much of a group delay, but doesn't filter more neither essentially... But I try to experiment a little. The group delay spec actually is my translation from a 20 ms "latency" spec (@fs=200 Hz). What is "latency" in my system, how it is measured and perceived that's a whole different story. For me, the term "latency" is pretty inacurrate, or even inappropriate, and I think of it rather as a marketing term... But I realized that group delay and "latency" match pretty well in my case. So that's why: max group delay = 4 samples. @Tim: I really appreciate your proposals, especially the one on being a hero, or brushing up my resumé secretly haha. ;) hmmp, I ever wondered how to get a Bessel filter right in the digital domain. I never succeeded. Any hints? Enjoy your week end Andy>On 3/26/14 8:27 PM, glen herrmannsfeldt wrote: >> mnentwig<24789@dsprelated> wrote: >> >> (previously snipped question) >> >>> what I'd do is use a very long FIR filter but enforce a group delay offour>>> samples in the numeric optimization. > >curious what the FIR, h[n], is for n >> 8 ? > >>> It's almost an IIR filter but it has >>> more design parameters than a conventional implementation withfeedback.>>> You can't meet all the requirements so specifying the best trade-off >>> becomes the main problem. The numerical optimization itself is usually >>> robust for a few dozen parameters. For more taps, use an analog filter/>>> IIR impulse response of your choice as initial value. >> >> The four sample group delay seems a little restrictive. >> > >it is. it means anything beyond the 9th tap (or "8th" if you count the >"0th" tap) contributes to a group delay greater than 4 samples. > >> For either the long FIR or IIR, you will have to allow any transients >> to die out. The OP didn't mention restrictions on that. > >but doesn't the physics (or maths)? > >how much energy do you dare put into h[n] after n=8? (i know we can >sorta PWM a low frequency component, but i think we have to "enforce a >group delay of four samples" on a restricted range of frequencies.) > > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >_____________________________ Posted through www.DSPRelated.com
Reply by ●March 28, 20142014-03-28
On 3/28/14 1:55 PM, ombz wrote:> > So it's definitely either a 1st order IIR or an 8-tap FIR, as I thought.actually a 9-tap FIR. h[0] is a tap with non-zero coefficient and h[8] is another (and equal valued, if it's phase-linear) tap. a 1-tap FIR is really just a static gain, and has group delay of 0 samples.> Not sure about that more-than-8-tap FIR.it cannot have constant group delay of 4 samples (assuming you mean "9-tap FIR").> Of course when you simply add very > weak taps you don't really add much of a group delay, but doesn't filter > more neither essentially...yup. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●March 28, 20142014-03-28
On Fri, 28 Mar 2014 12:55:13 -0500, ombz wrote:> Dear all, > > Thanks for your answers and hints! > > So it's definitely either a 1st order IIR or an 8-tap FIR, as I thought. > Not sure about that more-than-8-tap FIR. Of course when you simply add very > weak taps you don't really add much of a group delay, but doesn't filter > more neither essentially... But I try to experiment a little. > > The group delay spec actually is my translation from a 20 ms "latency" spec > (@fs=200 Hz). What is "latency" in my system, how it is measured and > perceived that's a whole different story. For me, the term "latency" is > pretty inacurrate, or even inappropriate, and I think of it rather as a > marketing term... But I realized that group delay and "latency" match > pretty well in my case. So that's why: max group delay = 4 samples. > > @Tim: I really appreciate your proposals, especially the one on being a > hero, or brushing up my resumé secretly haha. ;) > hmmp, I ever wondered how to get a Bessel filter right in the digital > domain. I never succeeded. Any hints? > > Enjoy your week end > > AndyHave you tried a bilinear transform of the Bessel filter? I haven't checked the responses in great detail but they seem to work. Of course, if you're sure you are limited to 1st order there isn't much point to it!
Reply by ●March 29, 20142014-03-29
>> it cannot have constant group delay of 4 samples (assuming you mean"9-tap FIR"). not strictly constant, as the impulse response is asymmetric. But that's no different from any recursive filter (exception: special cases like CIC). It's a trade-off between latency, group delay variation and magnitude response / filtering. The bad news here is, no linear filter can do a better job. I could simply take its impulse response and sample it into a long FIR. But you can use a numeric optimizer and _design_ the FIR for your own trade-off that is better suited to your specific requirements than one of the well-known textbook prototypes. BTW when designing this with numerical optimization, there is usually a bit of "cooking" involved, the requirements evolve with the filter design. _____________________________ Posted through www.DSPRelated.com
Reply by ●March 30, 20142014-03-30






