GNU Radio 3.7.0 C++ API
iir_filter_ffd.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004,2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_IIR_FILTER_FFD_H
00024 #define INCLUDED_IIR_FILTER_FFD_H
00025 
00026 #include <gnuradio/filter/api.h>
00027 #include <gnuradio/sync_block.h>
00028 
00029 namespace gr {
00030   namespace filter {
00031     
00032     /*!
00033      * \brief  IIR filter with float input, float output and double taps
00034      * \ingroup filter_blk
00035      *
00036      * \details
00037      * This filter uses the Direct Form I implementation, where
00038      * \p fftaps contains the feed-forward taps, and \p fbtaps the feedback ones.
00039      *
00040      * \p oldstyle: The old style of the IIR filter uses feedback
00041      * taps that are negative of what most definitions use (scipy
00042      * and Matlab among them). This parameter keeps using the old
00043      * GNU Radio style and is set to TRUE by default. When taps
00044      * generated from scipy, Matlab, or gr_filter_design, use the
00045      * new style by setting this to FALSE.
00046      *
00047      * The input and output satisfy a difference equation of the form
00048      \htmlonly
00049      \f{
00050      y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
00051      \f}
00052      \endhtmlonly
00053 
00054      \xmlonly
00055      y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k]
00056      \endxmlonly
00057 
00058      * with the corresponding rational system function
00059      \htmlonly
00060      \f{
00061      H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
00062      \f}
00063      \endhtmlonly
00064 
00065      \xmlonly
00066      H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}}
00067      \endxmlonly
00068 
00069      */
00070     class FILTER_API iir_filter_ffd : virtual public sync_block
00071     {
00072     public:
00073       // gr::filter::iir_filter_ffd::sptr
00074       typedef boost::shared_ptr<iir_filter_ffd> sptr;
00075 
00076       static sptr make(const std::vector<double> &fftaps,
00077                        const std::vector<double> &fbtaps,
00078                        bool oldstyle=true);
00079 
00080       virtual void set_taps(const std::vector<double> &fftaps,
00081                             const std::vector<double> &fbtaps) = 0;
00082     };
00083 
00084   } /* namespace filter */
00085 } /* namespace gr */
00086 
00087 #endif /* INCLUDED_IIR_FILTER_FFD_H */