Forums

Reduce Ringing in FIRs

Started by Randy Yates December 15, 2015
Gentle comp.dsp readers,

A requirement just popped up in one of my projects to redesign an FIR
lowpass filter so that it doesn't create so much time-domain ringing on
spikes. I had originally used octave's firls to design a linear-phase
lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response
has got a lot of wigglies.

Any thoughts/papers/google searches/bickering/smart remarks/dumb
ideas/etc. appreciated.
-- 
Randy Yates, DSP/Embedded Firmware Developer
Digital Signal Labs
http://www.digitalsignallabs.com
On Tue, 15 Dec 2015 18:05:58 -0500, Randy Yates wrote:

> Gentle comp.dsp readers, > > A requirement just popped up in one of my projects to redesign an FIR > lowpass filter so that it doesn't create so much time-domain ringing on > spikes. I had originally used octave's firls to design a linear-phase > lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response > has got a lot of wigglies. > > Any thoughts/papers/google searches/bickering/smart remarks/dumb > ideas/etc. appreciated.
Fsampling = 625Hz, Fstop = 150Hz? 'cause Fs = 625 and Fs = 150 is a bit of a stretch for me... I'm a philistine, so I'd just make a numerical optimization routine with a cost function that penalizes ringing and rewards fit to the ideal, then I'd let Scilab chew on it for a good long time to see if it comes up with something pretty. With, of course, fond remembrances of Vladimir's contempt for such shenanigans. To some extent a good sharp response means ringing; I don't know if there's a theoretical "best way" to make the filter, or if there is a way to start with a start- and stop- frequency and predict how much ringing there will be. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Randy Yates wrote:
> Gentle comp.dsp readers, > > A requirement just popped up in one of my projects to redesign an FIR > lowpass filter so that it doesn't create so much time-domain ringing on > spikes. I had originally used octave's firls to design a linear-phase > lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response > has got a lot of wigglies. >
Erm.... 3rd order (? what order?) Butterworth IIR? Should be pretty smooth. ( .24 = 150/625 = 30/125 = 6/25 = 0.24 ) Command line: mkfilter.exe -Bu -Lp -o 3 -a .24 raw alpha1 = 0.2400000000 ... Recurrence relation: y[n] = ( 1 * x[n- 3]) + ( 3 * x[n- 2]) + ( 3 * x[n- 1]) + ( 1 * x[n- 0]) + ( 0.0105030013 * y[n- 3]) + ( -0.3368436806 * y[n- 2]) + ( 0.1152020629 * y[n- 1])
> Any thoughts/papers/google searches/bickering/smart remarks/dumb > ideas/etc. appreciated. >
Just a sad note - Tony Fisher's website doesn't work any more :( or I've lost the URL to the one that does. -- Les Cargill
>Gentle comp.dsp readers, > >A requirement just popped up in one of my projects to redesign an FIR >lowpass filter so that it doesn't create so much time-domain ringing on >spikes. I had originally used octave's firls to design a linear-phase >lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response >has got a lot of wigglies. > >Any thoughts/papers/google searches/bickering/smart remarks/dumb >ideas/etc. appreciated. >-- >Randy Yates, DSP/Embedded Firmware Developer >Digital Signal Labs >http://www.digitalsignallabs.com
I think you want to use linear programming for this. It's very easy to add time domain constraints to a standard LP formulation with frequency domain constraints, since you're directly optimizing the impulse response coefficients. Simply limit the sum of the impulse response to be between a range of values, for the indexes you care about. A few lines of code in cvx should do the job ( http://cvxr.com/cvx/ ) --------------------------------------- Posted through http://www.DSPRelated.com
Les Cargill <lcargill99@comcast.com> writes:

> Randy Yates wrote: >> Gentle comp.dsp readers, >> >> A requirement just popped up in one of my projects to redesign an FIR >> lowpass filter so that it doesn't create so much time-domain ringing on >> spikes. I had originally used octave's firls to design a linear-phase >> lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response >> has got a lot of wigglies. >> > > Erm.... 3rd order (? what order?) Butterworth IIR? Should be pretty smooth. > > ( .24 = 150/625 = 30/125 = 6/25 = 0.24 ) > > Command line: mkfilter.exe -Bu -Lp -o 3 -a .24 > raw alpha1 = 0.2400000000 > ... > > Recurrence relation: > y[n] = ( 1 * x[n- 3]) > + ( 3 * x[n- 2]) > + ( 3 * x[n- 1]) > + ( 1 * x[n- 0]) > > + ( 0.0105030013 * y[n- 3]) > + ( -0.3368436806 * y[n- 2]) > + ( 0.1152020629 * y[n- 1]) > >
Les, thanks, that was a very nice try, but this has to be linear-phase. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
Tim Wescott <seemywebsite@myfooter.really> writes:

> On Tue, 15 Dec 2015 18:05:58 -0500, Randy Yates wrote: > >> Gentle comp.dsp readers, >> >> A requirement just popped up in one of my projects to redesign an FIR >> lowpass filter so that it doesn't create so much time-domain ringing on >> spikes. I had originally used octave's firls to design a linear-phase >> lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response >> has got a lot of wigglies. >> >> Any thoughts/papers/google searches/bickering/smart remarks/dumb >> ideas/etc. appreciated. > > Fsampling = 625Hz, Fstop = 150Hz? 'cause Fs = 625 and Fs = 150 is a bit > of a stretch for me...
Yes, I realized that after I hit the big green SEND button.
> I'm a philistine,
Hebrew here.
> so I'd just make a numerical optimization routine with > a cost function that penalizes ringing and rewards fit to the ideal, then > I'd let Scilab chew on it for a good long time to see if it comes up with > something pretty.
Oh, is that all? It would take a day just to look up all those terms and figure out what you're saying!
> With, of course, fond remembrances of Vladimir's contempt for such > shenanigans. > > To some extent a good sharp response means ringing; I don't know if > there's a theoretical "best way" to make the filter, or if there is a way > to start with a start- and stop- frequency and predict how much ringing > there will be.
Yeah, that's kinda why I asked the question. Am I essentially asking, "How do I make a filter with a sharp cutoff that doesn't have a sharp cutoff?"? -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Tuesday, December 15, 2015 at 5:06:05 PM UTC-6, Randy Yates wrote:
> Gentle comp.dsp readers, > > A requirement just popped up in one of my projects to redesign an FIR > lowpass filter so that it doesn't create so much time-domain ringing on > spikes. I had originally used octave's firls to design a linear-phase > lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response > has got a lot of wigglies. > > Any thoughts/papers/google searches/bickering/smart remarks/dumb > ideas/etc. appreciated. > -- > Randy Yates, DSP/Embedded Firmware Developer > Digital Signal Labs > http://www.digitalsignallabs.com
I assume by a lot of wigglies you mean too much ripple in the pass band. Try the following. It is 80dB down at 150Hz, and has 0.25 dB ripple in the pass band (showing half the coefficients). 0.0004 0.0001 -0.0023 -0.0064 -0.0078 -0.0014 0.0090 0.0109 -0.0032 -0.0199 -0.0145 0.0166 0.0385 0.0111 -0.0518 -0.0719 0.0219 0.2052 0.3552
maury001@core.com writes:

> On Tuesday, December 15, 2015 at 5:06:05 PM UTC-6, Randy Yates wrote: >> Gentle comp.dsp readers, >> >> A requirement just popped up in one of my projects to redesign an FIR >> lowpass filter so that it doesn't create so much time-domain ringing on >> spikes. I had originally used octave's firls to design a linear-phase >> lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response >> has got a lot of wigglies. >> >> Any thoughts/papers/google searches/bickering/smart remarks/dumb >> ideas/etc. appreciated. >> -- >> Randy Yates, DSP/Embedded Firmware Developer >> Digital Signal Labs >> http://www.digitalsignallabs.com > > I assume by a lot of wigglies you mean too much ripple in the pass band. Try the following. It is 80dB down at 150Hz, and has 0.25 dB ripple in the pass band (showing half the coefficients). > 0.0004 > 0.0001 > -0.0023 > -0.0064 > -0.0078 > -0.0014 > 0.0090 > 0.0109 > -0.0032 > -0.0199 > -0.0145 > 0.0166 > 0.0385 > 0.0111 > -0.0518 > -0.0719 > 0.0219 > 0.2052 > 0.3552
Maury, thanks. I meant its IMPULSE response has a lot of wigglies. The original filter has like 0.001 ripple in the passband. How did you generate this filter? -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Tuesday, December 15, 2015 at 9:38:20 PM UTC-6, Randy Yates wrote:
> maury001@core.com writes: > > > On Tuesday, December 15, 2015 at 5:06:05 PM UTC-6, Randy Yates wrote: > >> Gentle comp.dsp readers, > >> > >> A requirement just popped up in one of my projects to redesign an FIR > >> lowpass filter so that it doesn't create so much time-domain ringing on > >> spikes. I had originally used octave's firls to design a linear-phase > >> lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response > >> has got a lot of wigglies. > >> > >> Any thoughts/papers/google searches/bickering/smart remarks/dumb > >> ideas/etc. appreciated. > >> -- > >> Randy Yates, DSP/Embedded Firmware Developer > >> Digital Signal Labs > >> http://www.digitalsignallabs.com > > > > I assume by a lot of wigglies you mean too much ripple in the pass band. Try the following. It is 80dB down at 150Hz, and has 0.25 dB ripple in the pass band (showing half the coefficients). > > 0.0004 > > 0.0001 > > -0.0023 > > -0.0064 > > -0.0078 > > -0.0014 > > 0.0090 > > 0.0109 > > -0.0032 > > -0.0199 > > -0.0145 > > 0.0166 > > 0.0385 > > 0.0111 > > -0.0518 > > -0.0719 > > 0.0219 > > 0.2052 > > 0.3552 > > Maury, thanks. I meant its IMPULSE response has a lot of wigglies. The > original filter has like 0.001 ripple in the passband. > > How did you generate this filter? > -- > Randy Yates, DSP/Embedded Firmware Developer > Digital Signal Labs > http://www.digitalsignallabs.com
Matlab fdatools toolbox. Why are the *wiggles* in the impulse response of concern?
maury001@core.com writes:

> On Tuesday, December 15, 2015 at 9:38:20 PM UTC-6, Randy Yates wrote: >> maury001@core.com writes: >> >> > On Tuesday, December 15, 2015 at 5:06:05 PM UTC-6, Randy Yates wrote: >> >> Gentle comp.dsp readers, >> >> >> >> A requirement just popped up in one of my projects to redesign an FIR >> >> lowpass filter so that it doesn't create so much time-domain ringing on >> >> spikes. I had originally used octave's firls to design a linear-phase >> >> lowpass filter (Fs = 625 Hz, Fp = 100 Hz, Fs = 150 Hz), but its response >> >> has got a lot of wigglies. >> >> >> >> Any thoughts/papers/google searches/bickering/smart remarks/dumb >> >> ideas/etc. appreciated. >> >> -- >> >> Randy Yates, DSP/Embedded Firmware Developer >> >> Digital Signal Labs >> >> http://www.digitalsignallabs.com >> > >> > I assume by a lot of wigglies you mean too much ripple in the pass band. Try the following. It is 80dB down at 150Hz, and has 0.25 dB ripple in the pass band (showing half the coefficients). >> > 0.0004 >> > 0.0001 >> > -0.0023 >> > -0.0064 >> > -0.0078 >> > -0.0014 >> > 0.0090 >> > 0.0109 >> > -0.0032 >> > -0.0199 >> > -0.0145 >> > 0.0166 >> > 0.0385 >> > 0.0111 >> > -0.0518 >> > -0.0719 >> > 0.0219 >> > 0.2052 >> > 0.3552 >> >> Maury, thanks. I meant its IMPULSE response has a lot of wigglies. The >> original filter has like 0.001 ripple in the passband. >> >> How did you generate this filter? >> -- >> Randy Yates, DSP/Embedded Firmware Developer >> Digital Signal Labs >> http://www.digitalsignallabs.com > > Matlab fdatools toolbox. > > Why are the *wiggles* in the impulse response of concern?
These are ECG signals. If the patient has a pace maker, there are short spikes intermixed with the ECG data. If the filter has wiggles, the spikes ring. ring == bad (according to the customer, who is always right :) -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com