butt_filt_iir.cpp
上传用户:jtjnyq9001
上传日期:2014-11-21
资源大小:3974k
文件大小:2k
源码类别:

3G开发

开发平台:

Visual C++

  1. //======================================================
  2. //
  3. //  File = butt_filt_iir.cpp
  4. //
  5. //  Butterworth Filter by IIR model
  6. //
  7. #include "butt_filt_iir.h"
  8. #include "butterworth_proto.h"
  9. #ifdef _DEBUG
  10.   extern ofstream *DebugFile;
  11. #endif
  12. //======================================================
  13. //  constructor
  14. template < class T>
  15. ButterworthFilterByIir<T>::
  16.       ButterworthFilterByIir( char *instance_name,
  17.                               PracSimModel *outer_model,
  18.                               Signal<T> *in_sig,
  19.                               Signal<T> *out_sig )
  20.                   :AnalogFilterByIir<T>(  instance_name,
  21.                                           outer_model,
  22.                                           in_sig,
  23.                                           out_sig )
  24. {
  25.    MODEL_NAME(ButterworthFilterByIir);
  26.    //OPEN_PARM_BLOCK;
  27.    // All of the parameters needed to specify a 
  28.    // Butterworth filter are common to all the classic
  29.    // types: Chebyshev, Elliptical, Bessel.  Since they
  30.    // will be needed by all types of filters they are
  31.    // read by the AnalogFilter base class.
  32.    if( !Bypass_Enabled)
  33.    {
  34.       // construct a Butterworth prototype
  35.       Lowpass_Proto_Filt = 
  36.             new ButterworthPrototype(Prototype_Order);
  37.       Lowpass_Proto_Filt->FilterFrequencyResponse();
  38.       Lowpass_Proto_Filt->GetDenomPoly(false);
  39.    }
  40.    return;
  41. }
  42. //======================================================
  43. //  constructor for single-sample subordinate version
  44. template < class T>
  45. ButterworthFilterByIir<T>::
  46.          ButterworthFilterByIir( 
  47.                            char *instance_name,
  48.                            PracSimModel *outer_model )
  49.                   :AnalogFilterByIir<T>( 
  50.                               instance_name,
  51.                               outer_model )
  52. {
  53.    MODEL_NAME(ButterworthFilterByIir);
  54.    if( !Bypass_Enabled)
  55.    {
  56.       // construct a Butterworth prototype
  57.       Lowpass_Proto_Filt = 
  58.             new ButterworthPrototype(Prototype_Order);
  59.       Lowpass_Proto_Filt->FilterFrequencyResponse();
  60.       Lowpass_Proto_Filt->GetDenomPoly(false);
  61.    }
  62.    return;
  63. }
  64. //======================================================
  65. //  destructor
  66. template <class T>
  67. ButterworthFilterByIir<T>::~ButterworthFilterByIir(){};
  68. template ButterworthFilterByIir<float>;
  69. template ButterworthFilterByIir<std::complex<float> >;