DSPRelated.com
Forums

Low pass filters in the time domain?

Started by tomb18 April 20, 2015
On 21.04.2015 16:05, Bob Masta wrote:

(snip)

> I don't have much experience with IIR filters, but I do have > a fair amount with analog filters. If you cascade N > identical 1-pole analog filters you get a pile of mush, and > I think that IIR filters surely must be the same. Although > the numerical order of the filter may be technically N, the > overall performance is abysmal... not even remotely close to > a properly designed Nth order filter and certainly not an > Nth order Butterworth.
Seemingly I've suggested something stupid. I admit I've once tried cascading identical 1-pole IIRs and it didn't work out for me. Currently my best idea for a filter with a tunable cutoff frequency is a CIC filter. Best regards, Evgeny.
>On Mon, 20 Apr 2015 14:40:28 -0500, tomb18 wrote: > >> Hi, >> I have an IQ signal that I mix with a complex oscillator to bring >> signals down to 0 hz. I now need to do a lowpass filter on the >signal >> to remove all other signals before demodulating the signal. >> Currently, I have this working by using a 5 pole butterworth filter >with >> a cut off frequency of 3000Hz. This works nice, and I can get the >> coefficients from online resources. However, what I really want is a >> filter that one can adjust the cutoff frequency in real time and not >one >> that needs coefficients for every frequency. This if I want 3.0 kHz. >> 2.9kHz, etc down to 1.8 kHz I need 12 sets of coefficients. I tried >> something like this however, as one goes down in frequency the audio >> output level decreases to the point you can hardly hear it anymore. >Also >> if I also need a filter down to 400Hz, or even 50Hz it does not make >> sense to have all those filter coefficients. >> So can anyone suggest a better way? A better filter? > >Are you implementing your 5 pole Butterworth as an IIR filter? > >Why not calculate the coefficient values on the fly? > >As Eric pointed out, there's difficulties involved with changing cutoff > >frequencies on the fly (they'll probably sound like "THUMP!"), but if >you >ramp the cutoff frequency at a rate significantly slower (probably 5x, >at >a guess) than the filter's settling time you should be OK. If you can >calculate the coefficients on the fly, and if you have a means of >changing >them fairly rapidly, then you're made in the shade. > >You are implementing your 5-pole IIR filter as two 2nd-order filters and > >one 1st-order one, right? > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com
I am using the filters from here: http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html --------------------------------------- Posted through http://www.DSPRelated.com
>On 20.4.15 23:23, Randy Yates wrote: >> "tomb18" <103312@DSPRelated> writes: >> >>> Hi, >>> I have an IQ signal that I mix with a complex oscillator to bring >signals >>> down to 0 hz. I now need to do a lowpass filter on the signal to >remove >>> all other signals before demodulating the signal. >>> Currently, I have this working by using a 5 pole butterworth filter >with a >>> cut off frequency of 3000Hz. This works nice, and I can get the >>> coefficients from online resources. However, what I really want is >a >>> filter that one can adjust the cutoff frequency in real time and not >one >>> that needs coefficients for every frequency. This if I want 3.0 kHz. >>> 2.9kHz, etc down to 1.8 kHz I need 12 sets of coefficients. I tried >>> something like this however, as one goes down in frequency the audio >>> output level decreases to the point you can hardly hear it anymore. >Also >>> if I also need a filter down to 400Hz, or even 50Hz it does not make >sense >>> to have all those filter coefficients. >>> So can anyone suggest a better way? A better filter? >> >> You may get more useful responses if you back up a bit and state what >> your higher-level goal is. E.g, "I want to detect DTMF tones" or >> somesuch. > > >He's building a SSB receiver. > >There is an old Rohde & Schwartz patent with two conversions and >two filters to create continuously variable bandwidth. The patent >has gone old, and the construction has been in ham radios for some >decades. > >-- > >-TV
Hi, Yes I'm building a general purpose receiver. I have filters for SSB but I need them for CW. I'm attempting to use the same filters here for CW as well. Thanks --------------------------------------- Posted through http://www.DSPRelated.com
On Tue, 21 Apr 2015 06:18:53 -0700, radams2000 wrote:

> Look at digital state-variable filters. They have independent control of > frequency and Q, and if you are "oversampled enough" you can ignore the > errors from running in discrete time. So you can then have a global > frequency control variable applied to all stars-variable filters and > will frequency-scale the entire filter. I would recommend that you be > oversampled by a minimum factor of 4. > > Another approach is to use filter sections based on allpass filters. > Just Google "Sanjit Mitra", he is the master of this approach. > > Bob
The state-variable filters were where I was going to go also, specifically look for "Chamberlin". If you stay well away from the Nyquist rate then you can just tune the f of each stage and the q's will stay constant. As you get closer to Nyquist, the q's start changing too. If you want to avoid that, you'll need to stay well away from Nyquist; Bob's suggestion of 4 is if anything not conservative enough. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
On 4/21/15 1:01 PM, Rob Gaddi wrote:
> On Tue, 21 Apr 2015 06:18:53 -0700, radams2000 wrote: > >> Look at digital state-variable filters. They have independent control of >> frequency and Q, and if you are "oversampled enough" you can ignore the >> errors from running in discrete time. So you can then have a global >> frequency control variable applied to all stars-variable filters and >> will frequency-scale the entire filter. I would recommend that you be >> oversampled by a minimum factor of 4. >> >> Another approach is to use filter sections based on allpass filters. >> Just Google "Sanjit Mitra", he is the master of this approach. >>
...
> The state-variable filters were where I was going to go also, > specifically look for "Chamberlin". >
me too. i'm looking at Hal's SVF, and as i calculate it, one SVF coefficient is Fc = 2*sin(w0/2) and the other is Qc = (1/Q)*(w0/2)/(sin(w0/2) where w0 is normalized resonant frequency (as in DTFT). Qc is independent control of Q only for reasonably low resonant frequency. and i thought that Fc coef expression was only clear when Q is also reasonably high Q. both might be the case for my use.
> If you stay well away from the Nyquist rate then you can just tune the f > of each stage and the q's will stay constant. As you get closer to > Nyquist, the q's start changing too. If you want to avoid that, you'll > need to stay well away from Nyquist; Bob's suggestion of 4 is if anything > not conservative enough.
yup. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Tue, 21 Apr 2015 10:54:24 -0500, tomb18 wrote:

>>On Mon, 20 Apr 2015 14:40:28 -0500, tomb18 wrote: >> >>> Hi, >>> I have an IQ signal that I mix with a complex oscillator to bring >>> signals down to 0 hz. I now need to do a lowpass filter on the >>signal >>> to remove all other signals before demodulating the signal. Currently, >>> I have this working by using a 5 pole butterworth filter >>with >>> a cut off frequency of 3000Hz. This works nice, and I can get the >>> coefficients from online resources. However, what I really want is a >>> filter that one can adjust the cutoff frequency in real time and not >>one >>> that needs coefficients for every frequency. This if I want 3.0 kHz. >>> 2.9kHz, etc down to 1.8 kHz I need 12 sets of coefficients. I tried >>> something like this however, as one goes down in frequency the audio >>> output level decreases to the point you can hardly hear it anymore. >>Also >>> if I also need a filter down to 400Hz, or even 50Hz it does not make >>> sense to have all those filter coefficients. >>> So can anyone suggest a better way? A better filter? >> >>Are you implementing your 5 pole Butterworth as an IIR filter? >> >>Why not calculate the coefficient values on the fly? >> >>As Eric pointed out, there's difficulties involved with changing cutoff >> >>frequencies on the fly (they'll probably sound like "THUMP!"), but if >>you ramp the cutoff frequency at a rate significantly slower (probably >>5x, at a guess) than the filter's settling time you should be OK. If >>you can calculate the coefficients on the fly, and if you have a means >>of changing them fairly rapidly, then you're made in the shade. >> >>You are implementing your 5-pole IIR filter as two 2nd-order filters and >> >>one 1st-order one, right? >> >>-- >> >>Tim Wescott Wescott Design Services http://www.wescottdesign.com > > I am using the filters from here: > http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html
Step 1: learn why you don't want to implement your IIR filters in blocks bigger than 2nd order. See here: http://wescottdesign.com/articles/ zTransform/z-transforms.html. Read section 3, particularly the part about why the filter in listing 1 isn't a good idea. Step 2: learn how to design your own Butterworth filters, and how to do your own bilinear transforms. Then you won't have to depend on websites of unknown provenance. (Like mine!) -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 21.04.2015 20:01, Rob Gaddi wrote:

(snip)

> The state-variable filters were where I was going to go also, > specifically look for "Chamberlin". > > If you stay well away from the Nyquist rate then you can just tune the f > of each stage and the q's will stay constant. As you get closer to > Nyquist, the q's start changing too. If you want to avoid that, you'll > need to stay well away from Nyquist; Bob's suggestion of 4 is if anything > not conservative enough. >
Thanks! Hal Chamberlin's totally sounds like a book I want on my bookshelf. Evgeny.
On Tue, 21 Apr 2015 09:41:36 -0400, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On 4/21/15 9:05 AM, Bob Masta wrote: >> >> I don't have much experience with IIR filters, but I do have >> a fair amount with analog filters. If you cascade N >> identical 1-pole analog filters you get a pile of mush, > >well, if N=4 and you loop some feedback around the pile (and label the >knob with the word "regeneration"), you get what we, in the music >synthesizer domain, call a "4-pole Moog filter".
Hey, thanks for that! I have been interested in (and built) analog synthesizers since the early days and hadn't heard that term. But you bring up an important point, which is exactly the difference between 2 cascaded 1-poles and one 2-pole filter: It's the feedback. If you cascade 2 RC stages (ie cascade two 1-pole filters) you get droop, and not just from the second stage loading the first. The simple Sallen-Key 2-pole topology just applies a buffer to the output of the cascaded RCs, then feeds the buffer output back to the ground return of the first RC. A little gain on the buffer (or messing with the R or C values) allows this to implement any 2-pole damping / Q value. Best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!
you might think that this is a settled issue, especially before any 
"digitization" of the transfer function.  so, for the moment, let's 
leave the z-plane outa it.

originally, i always took the definition of "Q" and resonant frequency 
"w0" (pronounced "omega-naught" not "dubya-zero" even though we all know 
he's a zero) as coming from the classic RLC series circuit (with output 
voltage taken over the R) having transfer function:

    H(s) =  R / ( R + sL + 1/(sC) )

which if you re-arrange it a  little, you get this BPF:

    H(s) =  (1/Q)(s/w0) / ( (s/w0)^2 + (1/Q)(s/w0) + 1 )


for w0 = 1/sqrt(LC)  and  Q = w0*L/R

when s = j*w0 you get H(j*w0) = 1 which has greater magnitude than any 
other real frequency.

but this is not necessarily the frequency at which the circuit "rings" 
at if whacked with an impulse.

    h(t) =  w0 * exp(-(w0/2Q)*t) * cos( sqrt(1-(1/2Q)^2)*w0*t + phi )

                            phi = arctan(1/2Q) i think


the "ringing frequency" is sqrt(1-(1/2Q)^2)*w0 .  if the Q is smaller 
than 1/2, this thing doesn't even ring and you have two damped 
exponentials in the impulse response rather than a damped sinusoid. 
(instead of a pair of complex-conjugate poles, there is a pair of real 
poles.)

now, can we agree that the resonant frequency of this analog transfer 
function is w0 which exists for any Q>0 ?  even if this thing does not ring?

the reason i am asking is, reviewing some very old notes regarding Hal's 
SVF *and* with the Lattice filters, i am wondering if the "frequency" 
that the filters are tuned to are the ringing frequency (that exists 
only for Q > 1/2) and not the resonant frequency (which still has 
meaning for low-pass filters that don't ring at all).

so which is it?  (consider this a polling question.)


-- 

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."






On 4/21/15 2:19 PM, robert bristow-johnson wrote:
> On 4/21/15 1:01 PM, Rob Gaddi wrote: >> On Tue, 21 Apr 2015 06:18:53 -0700, radams2000 wrote: >> >>> Look at digital state-variable filters. They have independent control of >>> frequency and Q, and if you are "oversampled enough" you can ignore the >>> errors from running in discrete time. So you can then have a global >>> frequency control variable applied to all stars-variable filters and >>> will frequency-scale the entire filter. I would recommend that you be >>> oversampled by a minimum factor of 4. >>> >>> Another approach is to use filter sections based on allpass filters. >>> Just Google "Sanjit Mitra", he is the master of this approach. >>> > ... >> The state-variable filters were where I was going to go also, >> specifically look for "Chamberlin". >> > > me too. > > i'm looking at Hal's SVF, and as i calculate it, one SVF coefficient is > > Fc = 2*sin(w0/2) > > and the other is > > Qc = (1/Q)*(w0/2)/(sin(w0/2) > > where w0 is normalized resonant frequency (as in DTFT). > > Qc is independent control of Q only for reasonably low resonant > frequency. and i thought that Fc coef expression was only clear when Q > is also reasonably high Q. > > both might be the case for my use. > >> If you stay well away from the Nyquist rate then you can just tune the f >> of each stage and the q's will stay constant. As you get closer to >> Nyquist, the q's start changing too. If you want to avoid that, you'll >> need to stay well away from Nyquist; Bob's suggestion of 4 is if anything >> not conservative enough. > > yup. > >
Bringing the z-plane into it...since I wrangled my usage of the nomenclature, I've referred to a resonance as a local maximum that occurs in a magnitude frequency response (or a signal's mag. FT); where it appears is a resonant frequency . Briefly, the argument times t in cos() or sin() is the pole angle, modal frequency, or eigenfrequency.