Re: Slow varying inputs

On Fri, Mar 04, 2005 at 09:22:20AM +0000, Bernd Porr wrote:
> The reason for using a notch filter is that I don't want to throw away 
> all the frequencies above 50Hz. In my case it was ECG. You can use a low 
> pass at around 40Hz to filter an ECG but then the peaks of the ECG 
> become much smaller. Bad for the patient. ;-) The full spectrum reaches 
> up to 100Hz. When I sample with 1kHz I don't need an anti alias filter, 
> thus no soldering, etc.
> 
> The notch filter takes the raw data from comedi and filters it. 
> Afteraging comes after the notch filter. I think the only thing to 
> change is the frequency to 60Hz. Or you could just add a text field so 
> that everybody can change it. It also works pretty good as an DC filter 
> with f is set to zero.

Bernd,

After a few hours of getting into the whole DSP space again (it's been
a few years since I did this in school...) things are slowly starting
to make sense again... I worked in octave for a while looking at the
IIR notch filter that you have. Seems to do quite a good job at the
speficied frequency f, though I noticed that the filter will give you
a gain of a couple of percent in the passband region. Was this
intentional ? I hope a came to the correct conclusion, I plotted the
filter gain as a function of frequency and saw this gain. I could also
come to the same conclusion by taking the ratio of the sums for the
nominator and denominator filter coefficients. I'm not trying to
complain here, just make sure I remember my DSP correctly...

I've been playing with different kinds of filters to compare
performance, while doing so I found that I could create an IIR filter
with a relatively small order (4 for example) that would act as a very
efficient low-pass filter. To get the same characteristics using an
FIR filter I had to create a much higer order (>30), this makes sense
to me. Correct me if I'm wrong...

 From reading various FAQs I find that one of the concerns with IIR
filter over FIR filters is stability. Would that be a concern in an
application where I use samples from Comedi ?

Thanks
Daniel

> Daniel Nilsson wrote:
> >On Thu, Mar 03, 2005 at 09:36:42AM +0000, Bernd Porr wrote:
> >
> >>You can use the program 
> >>http://www.linux-usb-daq.co.uk/software2/comedi-record/
> >>to sample quite slowly. It internally always samples at 1kHz and then 
> >>averages on the fly to get a lower rate. It also has a 50Hz notch filter 
> >>(sorry, American colleagues). However, the filter frequency can be 
> >>changed in the program. I used it also with thermocouple sensors.
> >
> >
> >Bernd,
> >
> >Thanks for the pointer, this is very close to exactly what I was
> >looking for. From looking closer at your filter characteristics in the
> >code I see that you are creating a pretty sharp notch filter. From the
> >description above I take it that the purpose of this notch filter was
> >to only take care of the 50Hz noise ? Is there a specific reason why
> >you decide to do a notch filter instead of a low-pass filter in your
> >application ? Is the notch filter applied before the averaging
> >function ?
> >
> >Thanks

-- 
Daniel Nilsson

Received on 2005-03-06Z23:32:16