# Re: [psas-avionics] Digital filters

```I don't know much about this sort of thing.

I'm guessing that a different implementation could have better numeric
stability properties.```
```
Your key-phrase seems to be, "Series of first order difference
equations." Is that different than MAC-ing a polynomial equation?

I've done similar type things with the latter without trouble, but never
as low as 1 Hz.

--

I'm seeing my filter-aware friend on Wednesday, and i'll ask him for
some advice. If that doesn't work, and thinking on Tuesday fails, let's

(2009.11.02) kirk...@pdx.edu:
> Hey All,
> I'm looking for advice from someone who's DSP foo is stronger than
> mine to help with a filter applied to the roll control system..
>
> Problem:
> Implement a 2nd-order low-pass filter (butterworth would be fine)
> with a 1Hz cutoff frequency and a sampling rate of 1000Hz. Input is
> uint16, 0-65535 from an ADC.
>
> My usual solution:
> Create the appropriate transfer function, then use Matlab c2d
> command to obtain the coefficients. Finally, build the filter as a
> series of first order difference equations. This is working in
> several products in production, but isn't quite right for our rocket
> roll-controller.
>
> The reason this isn't working:
> 1) Matlab c2d gives only 4 significant figures, regardless of the
> format setting.
> 2) Using only 4 significant figures propagates errors in the filter
> which make it unstable.
> 3) When the coefficients are obtained by calculation
> (float-doubles), the DC offset is too big to make the filter useful
> when converted to fixed point math.
> 4) The fixed point data sizes get kind-of big for such a simple
> filter (long long) if I want to keep my resolution.
> 5) Filter coefficients for a 1000Hz sample rate and a 1Hz cutoff are
> so far apart in size (1 vs. 0.00000009808) that 64 bit math or
> slower sampling are likely the only solutions.
>
> A couple of questions:
> 1) Is there another way to realize a discrete fixed-point filter
> that has little (1-2 LS bits) offset and full resolution on a 16 bit
> input?
>
> 2) Can another filter be designed more easily ( I had to derive the
> filter using a bilinear transform. Frequency warping wasn't used
> because the sampling frequency is much faster than the corner
> frequency. )?
>
> Anyone have any thoughts?

_______________________________________________
psas-avionics mailing list
psas-avionics@lists.psas.pdx.edu
http://lists.psas.pdx.edu/mailman/listinfo/psas-avionics
```