GNU Radio 3.6.5 C++ API
|
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 <filter/api.h> 00027 #include <gr_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 * 00041 * The input and output satisfy a difference equation of the form 00042 \htmlonly 00043 \f{ 00044 y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] 00045 \f} 00046 \endhtmlonly 00047 00048 \xmlonly 00049 y[n] - \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] 00050 \endxmlonly 00051 00052 * with the corresponding rational system function 00053 \htmlonly 00054 \f{ 00055 H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} 00056 \f} 00057 \endhtmlonly 00058 00059 \xmlonly 00060 H(z) = \ frac{\sum_{k=0}^{M} b_k z^{-k}}{1 - \sum_{k=1}^{N} a_k z^{-k}} 00061 \endxmlonly 00062 00063 * Note that some texts define the system function with a + in the 00064 * denominator. If you're using that convention, you'll need to 00065 * negate the feedback taps. 00066 */ 00067 class FILTER_API iir_filter_ffd : virtual public gr_sync_block 00068 { 00069 public: 00070 // gr::filter::iir_filter_ffd::sptr 00071 typedef boost::shared_ptr<iir_filter_ffd> sptr; 00072 00073 static sptr make(const std::vector<double> &fftaps, 00074 const std::vector<double> &fbtaps); 00075 00076 virtual void set_taps(const std::vector<double> &fftaps, 00077 const std::vector<double> &fbtaps) = 0; 00078 }; 00079 00080 } /* namespace filter */ 00081 } /* namespace gr */ 00082 00083 #endif /* INCLUDED_IIR_FILTER_FFD_H */