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

3G开发

开发平台:

Visual C++

  1. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. //
  3. //  File = elip_filt_iir.cpp
  4. //
  5. //  Elliptical Filter
  6. //
  7. //#include <math.h>
  8. //#include "misdefs.h"
  9. #include "parmfile.h"
  10. #include "elip_filt_iir.h"
  11. #include "elliptical_proto.h"
  12. //#include "filter_types.h"
  13. extern ParmFile *ParmInput;
  14. #ifdef _DEBUG
  15.   extern ofstream *DebugFile;
  16. #endif
  17. //======================================================
  18. //  constructor
  19. template <class T>
  20. EllipticalFilterByIir<T>::EllipticalFilterByIir( char *instance_name,
  21.                                   PracSimModel *outer_model,
  22.                                   Signal<T> *in_sig,
  23.                                   Signal<T> *out_sig )
  24.                   :AnalogFilterByIir<T>( instance_name,
  25.                                outer_model,
  26.                                in_sig,
  27.                                out_sig )
  28. {
  29.   MODEL_NAME(EllipticalFilterByIir);
  30.   OPEN_PARM_BLOCK;
  31.   // Most of the parameters needed to specify an elliptical filter
  32.   // are common to all the classic types and are therefore
  33.   // read by the AnalogFilter base class.
  34.   //
  35.   // separate values for 'Passband_Ripple' and 'Stopband_Ripple' are
  36.   // specific to elliptical so they are read here in the derived class
  37.   
  38.   if( !Bypass_Enabled)
  39.     {
  40.     GET_DOUBLE_PARM(Passband_Ripple_In_Db);
  41.     GET_DOUBLE_PARM(Stopband_Ripple_In_Db);
  42.     GET_DOUBLE_PARM(Norm_Hz_Stop_Edge);
  43.     Selec_Factor = Norm_Hz_Pass_Edge / Norm_Hz_Stop_Edge;
  44.     // construct a elliptical prototype
  45.     Lowpass_Proto_Filt = new EllipticalPrototype( Prototype_Order, 
  46.                                                   Passband_Ripple_In_Db,
  47.                                                   Stopband_Ripple_In_Db,
  48.                                                   Selec_Factor);
  49.     Lowpass_Proto_Filt->FilterFrequencyResponse();
  50.     //Lowpass_Proto_Filt->DumpBiquads(DebugFile); 
  51.     Lowpass_Proto_Filt->GetDenomPoly(false);
  52.     }
  53.   return;
  54. }
  55. template <class T>
  56. EllipticalFilterByIir<T>::~EllipticalFilterByIir(){};
  57. template EllipticalFilterByIir<float>;
  58. template EllipticalFilterByIir<std::complex<float> >;