buttfunc.cpp

来自「Digital filter designer s handbook C++ c」· C++ 代码 · 共 40 行

CPP
40
字号
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  File = buttfunc.cpp
//
//  Butterworth Filter Response
//

#include <math.h>
#include "misdefs.h"
#include "buttfunc.h"

extern ofstream DebugFile;

//======================================================
//  constructor

ButterworthTransFunc::ButterworthTransFunc( int order )
                          :FilterTransFunc(order)
{
 double x;
 
 Prototype_Pole_Locs = (double_complex*) new double[2*(order+1)];
 Num_Prototype_Poles = order;
 Prototype_Zero_Locs = (double_complex*) new double[2];
 Num_Prototype_Zeros = 0;
 
 H_Sub_Zero = 1.0;
 DebugFile << "in Butterworth Resp, H_Sub_Zero set to "
           << H_Sub_Zero << endl;
 
 for(int k=1; k<=order; k++)
   {
    x = PI * (order + (2*k)-1) / (2*order);
    Prototype_Pole_Locs[k] = double_complex( cos(x), sin(x) ); 
    DebugFile << "pole[" << k << "] = "
              << Prototype_Pole_Locs[k] << endl;
   }
 return;
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?