Re: Slow varying inputs

On Tue, Mar 08, 2005 at 10:07:15AM -0500, Sandy Pond wrote:
> On Sun, 2005-03-06 at 22:26 -0500, Daniel Nilsson wrote:
> > 
> > Thanks, I have been looking at your code trying to figure out if you
> > are implementing an FIR or IIR filter ? Or is it some other kind of
> > filter ? Sorry for the basic questions here...
> 
> It uses trapezoidal integration.  The proof is rather easy but I can't
> seem to find something like it by googling around.  Therefore, I can't
> give you a pointer.  If you want I'll write it up and post it.  It's a
> home made algorithm so I don't know what to call it, but I'm certain
> someone else might know (perhaps TIR for Trapezoidal Integrated Response
> filter).  I put it together in the '80s when I was doing digital
> simulations then later modified it to use integer math for
> microprocessors with A/D.

I got a chance to test your filter code on some sampled data
yesterday. It works really well actually, the code is fast compared to
FIR filters (filtered 65536 samples in 2.2ms on my machine) and produces
a sharp low pass filter. I think I'll try to use your filter in my
application, looks like this will fir very well what I needed. Thanks
for putting this together !

> If you want to run your data though the filter and your data is in a
> file then just use the program I posted and modify it for your cutoff
> frequency and use fopen/scanf to read in your raw data stream.  Warning:
> the data needs to be integers that are less than 65536 (short int).  The
> routine was written for A/D counts.

So the next question is then where I put in the filter... What I did
what just scale my samples from float by a factor (10000 in my case )
so that I could treat them as unsigned short int (16bits). My A/D
converter is a 16 bit converter as well, but I can't quite figure out
from the Comedi documentation if this means I can run the samples
directly from the read() command through the filter or if I first need
to do the comedi_to_phys() function ? How is the sign information
stored ? 

Thanks
-- 
Daniel Nilsson

Received on 2005-03-10Z23:38:00