[comp.dsp] Designing Recursive Filters

mcmahan@netcom.UUCP (Dave Mc Mahan) (07/24/90)

I have been given the task to design and implement in software a digital
filter.  The sample rate (for historical reasons) has to be 250 samps/second,
and the filter needs to be designed to notch at either 60 Hz or 50 Hz to
remove power line influences in the signal.  Samples will be 7 bit 2's
compliment values.  Since the signal is an ECG (electro-cardiogram), I must
preserve linear phase to ensure group delay is constant and the signal does
not 'smear' in time as it passes through the filter.  The CPU we will use
will be a 68000 unless I can prove it won't cut it.

I have a degree in Elect. Eng., but have been specializing in writing realtime
software for the past several years.  I have had classes in signal analysis
and some exposure to the subject, but it is not my specialty.  Due to the
assignment, I have been reviewing the field of filters.  I have a program
called matlab that runs on a PC-AT clone that is quite capable of helping me
in the analysis.

I have decided to use Z-transforms to analyze the problem.  I have located
some papers that help explain what I need to do, but have some questions.
They are:

1) I have succeeded in writing the difference equations for an IIR filter.  As
   I see it, the 60 Hz notch will be the hardest, as it is not a nice integer
   multiple of my sample frequency.  Since implementing delay is no problem
   (relatively) on the CPU of choice, I have decided to work in 10 Hz increments
   and give myself 25 'zeros' in band so I can pick the cutoff frequency to
   within 10 Hz resolution.  This is the closest integer multiple of zeros I
   can pick, as far as I can tell.  I need to arrange my filter (I plan on
   using a high pass and a low pass that both cut off at the frequency of
   interest and then algebraically sum the two outputs to give the desired
   response) so that I pick the sixth zero in band.  My question is, how do
   I modify the difference equation so that I roll off at the sixth zero?
   I can get it to roll off at the first, but have had no luck at figuring
   out how to pick the sixth.  The transfer equation I use for the first 
   zero is :


                  -50  2
  G(z) =    (1 - Z   ) 
          -----------------
                  -1  2
            (1 - Z   )

   This gives me second order poles and zeros, which I will try first to see
   if I get the type of response I want.  How do I change it to provide the
   same low pass response, but at the sixth pole/zero?


2)  In the paper I am using as a guideline, they state that, "using 600
    zeros in the example produces an impulse response that is antisymetric,
    so instead we will use 606".  Why wouldn't they pick 602 zeros instead
    of 606?  It would seem that this is the next logical number to use,
    since it is a multiple of 2 but not 4.  I assume that picking a multiple
    of 4 is what produces the antisymetric impulse response.  Is this correct?

3)  I assume that eventually, I will prove to myself that using an IIR
    filter will cause severe phase distortion and will distort the signal.
    I will therefor have to go to using an FIR structure, but this will give
    my lots more math to perform on my CPU.  Are there any tips (besides
    shift/add instead of multiply) that anyone can suggest to cut down the
    number of math operations I will need to use?


Thanks for any help.  As you may be able to see from this post, I'm not by
any means a leading expert on filter design.  Any tips suggestions or help
you can offer will be appreciated.


  -dave