⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 floatpoint_directiir.c

📁 CHP 5 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 C
字号:
// 
//  Project: Experiment 5.7.1: implementation of floating-point IIR filter in direct form I - Chapter 5
//  File name: floatPoint_directIIR.c   
//
//  Description: This is the floating-point direct form I IIR filter realization
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#include "floatPointIIR.h"

void floatPoint_IIR(double in, double *x, double *y, 
                    double *b, short nb, double *a, short na)
{
  double z1,z2;
  short i;

  for(i=nb-1; i>0; i--)         // Update the delay line x[]
  {
    x[i] = x[i-1];
  }
  x[0] = in;                    // Insert new data to delay line x[0]

  for(z1=0, i=0; i<nb; i++)     // Filter the x[] with coefficient b[]
  {
    z1 += x[i] * b[i];
  }
	
  for(i=na-1; i>0; i--)         // Update the y delay line
  {
    y[i] = y[i-1];
  }

  for(z2=0, i=1; i<na; i++)     // Filter the y[] with coefficient a[]
  {
    z2 += y[i] * a[i];
  }
  y[0] = z1 - z2;               // Place the result into y[0]

}

⌨️ 快捷键说明

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