Sreeraj,
Thanks for the explanation and the GRC files. Your explanation
was right
in line with how I expected gr.iir_filter_ffd to work
and what it needed
for parameters. It turns out that I was using
gr.iir_filter_ffd correctly,
but the filter coefficients I was using were causing the
numerical problems.
When I designed a filter with a less restrictive rolloff, the
generated
coefficients worked properly in gr.iir_filter_ffd. As
you stated, I need
to use a more relaxed specification. I guess when you have "b"
coefficients with values on the order of 10^13, you end up with
numerical
instability or mathematical underflow/overflow. Perhaps the IIR
filter
calculation tools I was using generated invalid coefficients
(Website
http://wwwusers.cs.york.ac.uk/~fisher/mkfilter/trad.html and
Octave's
butter function).
Mac
On 08/10/2012 06:24 AM, sreeraj r wrote:
>I
am trying to emulate an 8thorder Butterworth lowpass
filter using
>gr.iir_filter_ffd in GNU Radio. I cannot
seem to implement an IIR filter
> with such a steep rolloff in
gr_filter_design. The filter characteristic
>I want are as follows:
>Sample Rate: 128,000 sps
>Cutoff (3 dB) frequency: 1200 Hz
(0.009375 normalized)
>End of Passband: 900 Hz (0.00703125
normalized)
>Start of Stop Band: 6000 Hz (0.046875
normalized)
>Max Loss in Pass Band: 1 dB
>Min Attenuation in Stop Band: 110
dB
>When I plug in the last four values above
into gr_filter_design and press
>the Design button, the following message
is displayed on the console:
>/usr/lib/python2.6/distpackages/scipy/signal/filter_design.py:221:
>BadCoefficients: Badly conditionned
filter coefficients (numerator):
>the results may be meaningless
> "results may be meaningless",
BadCoefficients)
Scipy
is throwing this warning as the designed filter
parameters(b) for your filter specifications are
really small (less than 1e14). gr_filter_design
directly uses scipy's iirdesign and iirfilter
functions. I followed the normal design
procedure to make sure whether things are right
import scipy.signal as sg
sg.buttord(0.00703125, 0.046875, 1, 110) 
gave me this (8, 0.009642594623660591)
sg.butter(10, 0.009642594623660591) 
again gave me bad coefficients error.
I believe you have to relax some specifications
to get some practical filter parameters.
>In the end, I was hoping that the new
functionality in gr_filter_design
>would help with solving another problem
that I am having. That is that
>I cannot seem to get gr.iir_filter_ffd to
execute properly. I tried
>plugging in different sets of
feedforward (b) and feedback (a)
>coefficients generated with other IIR
filter design tools (and now
>gr_filter_design) without success. I
always end up with strange NaN
>errors when I run GNU Radio scripts that
include gr.iir_filter_ffd. I
>have searched without success in finding
useful guidelines for using
>gr.iir_filter_ffd.
You
may be ending up with NaN errors because you
might be specifying the feedback taps wrongly.
iir_filter_ffd expects the transfer function in
this format
H(z) = \ frac{\sum_{k=0}^{M} b_k z^{k}}{1 
\sum_{k=1}^{N} a_k z^{k}}
Usually scipy or any other filter design tool,
might not be returning the filter coefficients
in this "1  a_k" format. So please make sure
that you reverse the sign of a_ks.
I am also attaching two sample grc files which
use iir_filter_ffd. The filters (one butter and
elliptic) are designed using gr_filter_design
with the following normalized spec and the
feedback taps negated as I already mentioned.
End of pass band = 0.2
Start of stop band = 0.45
Max loss in pb = 1dB, Min atten in sb = 110dB.
I am also a newbie and could be wrong somewhere.
Hope this helps.
Sreeraj
