>gr.iir_filter_ffd in GNU Radio. I cannot seem to implement an
IIR filter
>
with such a steep roll-off in gr_filter_design. The
filter characteristic
>I want are as follows:
>Sample Rate: 128,000 sps
>Cut-off (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/dist-packages/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 1e-14). 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 feed-forward (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