bp45hpt

来自「"DIGITAL SIGNAL PROCESSING WITH C AND TH」· 代码 · 共 37 行

TXT
37
字号
/*BP45HPT-PARTIAL FIR USING HYPERSIGNAL MODIFIED FOR I/O*/
#define N 45          /*length of impulse response*/
int start_index = 0;  /*circ buffer start position*/
double H[N];          /* filter coefficients*/
double DLY[N];        /* delay samples      */
double filt(stage_input)    /*filter routine*/
double stage_input;
{
  double acc;
  int   i, j;
  DLY[start_index] = stage_input;
  j = --start_index;
  acc = 0.0;
  for (i=0; i<N; i++)
  {
    j = ++j % N;  /*circular buffer requires modulo*/
    acc += H[i] * DLY[j];
  }
  start_index = j;
  return acc;
}

main ()
{
  #define IMPULSE_LENGTH 45   /* length of impulse response */
  volatile int *IO_OUT = (volatile int *) 0x804001; /*added for i/o*/
  int   n;
  *IO_OUT = filt(10000.0);  /*the "impulse"        */
  for (n=1; n<IMPULSE_LENGTH; n++)
  {
    *IO_OUT = filt(0.0);      /*other values are zero*/
  }
}



⌨️ 快捷键说明

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